Decode image data from raw encoded binary data in any image format: PNG, GIF, BMP, JPEG, TIFF.
let decode = require('image-decode')
let {data, width, height} = decode(fs.readFileSync('./data.png'))
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
- base64 string
- image-encode − encode pixels data to target format.
- image-equal − image data comparing tool.
- image-pixels − load or save pixel data from/to any source.
- image-save − save image pixels data to a target.
- image-type − detect input image data type.
© 2018 Dmitry Yv. MIT License.