mri.js
v1.1.0
Published
Decoder for MangaRock images (.mri)
Readme
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.jsExamples
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, ...