@cwasm/jpeg-turbo
v0.1.3
Published
JPEG decoding for Node.js, using [libjpeg-turbo][libjpeg-turbo] compiled to [WebAssembly][WebAssembly].
Downloads
19,240
Readme
JPEG
JPEG decoding for Node.js, using libjpeg-turbo compiled to WebAssembly.
Installation
npm install --save @cwasm/jpeg-turbo
Usage
const fs = require('fs')
const jpeg = require('@cwasm/jpeg-turbo')
const source = fs.readFileSync('image.jpg')
const image = jpeg.decode(source)
console.log(image)
// { width: 128,
// height: 128,
// data:
// Uint8ClampedArray [ ... ] }
API
decode(source)
source
(Uint8Array
, required) - The JPEG data- returns
ImageData
- Decoded width, height and pixel data