Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

bake/mri.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MangaRock Image decoder

npm version

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, ...

Releases

No releases published

Packages

No packages published