package
Read an image (jpg, png, gif) into memory in the same format.
npm install readimageGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 6 packages.
122.1 kB
Includes dependencies.
5 direct · 2 outdated
^1.0.5
1.0.10
0.0.4
0.4.4
^1.0.0
1.0.0
^2.0.1
2.0.1
0.0.1
1.0.1
Read an image into memory converting from whatever format it is in to a consistent set of RGBA frames independent on input format.
Why? Because image formats are a pain to worry about.
How fast is it? Not really sure. I don't need it to be fast.
How robust is it? Not really sure, if you have issues please file them!
var fs = require("fs")
var readimage = require("readimage")
var filedata = fs.readFileSync("cat.png")
readimage(filedata, function (err, image) {
if (err) {
console.log("failed to parse the image")
console.log(err)
}
console.log(image)
})
require("readimage")(imageBuffer, callback)Read a buffer containing an image in PNG, GIF, or JPG format into a consistent RGBA format.
height, width, and an array of sequential frames. Non-animated images will have a single frame.
{
height: 100, // pixels
width: 100, // pixels
frames: [
{
data: ... // RGBA buffer
delay: 100 // milliseconds before switching to next frame. OPTIONAL
},
{
data: ...
delay: 10
}
]
}MIT