image-decode

1.2.2 • Public • Published

image-decode unstable Build Status

Decode image data from raw encoded binary data in any image format: PNG, GIF, BMP, JPEG, TIFF.

Usage

npm install image-decode

let decode = require('image-decode')
 
let {data, width, height} = decode(fs.readFileSync('./data.png'))

API

let {data, width, height} = decode(buffer, mimeType?)

Takes input buffer with encoded image data and decodes its contents, returns pixels data array with layout [r, g, b, a, r, g, b, a, ...]. mimeType can be passed to skip image type detection.

buffer can be any binary data container:

  • ArrayBuffer
  • Buffer
  • Uint8Array
  • File
  • Blob
  • base64 string

See also

Credits

© 2018 Dmitry Yv. MIT License.

Package Sidebar

Install

npm i image-decode

Weekly Downloads

3,331

Version

1.2.2

License

MIT

Unpacked Size

9.31 kB

Total Files

12

Last publish

Collaborators

  • dy