You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sigonasr2
0785506fad
|
4 years ago | |
---|---|---|
.. | ||
.eslintrc.json | 4 years ago | |
.travis.yml | 4 years ago | |
bmp.js | 4 years ago | |
gif.js | 4 years ago | |
index.js | 4 years ago | |
jpg.js | 4 years ago | |
package.json | 4 years ago | |
png.js | 4 years ago | |
readme.md | 4 years ago | |
test.js | 4 years ago | |
tiff.js | 4 years ago | |
webp.js | 4 years ago |
readme.md
image-decode
Decode image data from raw encoded binary data in any image format: PNG, GIF, BMP, JPEG, TIFF.
Usage
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
- 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.
Credits
© 2018 Dmitry Yv. MIT License.