1.1.0 • Published 5 years ago

mri.js v1.1.0

Weekly downloads
1
License
GPL-3.0
Repository
-
Last release
5 years ago

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

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago