mri.js
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

MangaRock Image decoder

mri.js decodes .mri (MangaRock Image) files. MRIs are basically XORed WEBP images without the corresponding header. This module uses webp-hero to decode and render the resulting WEBPs.

Installation

$ npm install --save mri.js

Examples

Replace all images

import { MriMachine } from 'mri.js'

const mriMachine = new MriMachine
mriMachine.polyfillDocument()

Replace a specific image

import { MriMachine } from 'mri.js'

const mriMachine = new MriMachine
const image = document.querySelector('img[src$=".mri"]')
mriMachine.polyfillImage(image)

Only decode an MRIs body

import { MriMachine } from 'mri.js'

const mriMachine = new MriMachine
fetch('image.mri')
	.then(res => res.arrayBuffer())
	.then(buff => new Uint8Array(buff))
	.then(arr => mriMachine.decode(arr))
	.then(console.log) // 82, 73, 70, 70, ...

Readme

Keywords

Package Sidebar

Install

npm i mri.js

Weekly Downloads

2

Version

1.1.0

License

GPL-3.0

Unpacked Size

48.5 kB

Total Files

10

Last publish

Collaborators

  • bake