This is a fork of pngparse
that synchronously parses PNG data encoded as buffers. It works in both node.js and browserify.
var fs = require("fs")
var parsePNG = require("pngparse-sync")
console.log(parsePNG(fs.readFileSync("myimage.png")))
npm install pngparse-sync
Parses a buffer synchronously into a PNG
buffer
is aBuffer
Returns null
if there was an error parsing the PNG file, or an object with the following properties:
width
the width of the image in pixelsheight
the height of the image in pixelschannels
the number of channels in the imagedata
a Uint8Array storing the pixels of the image
This software is available in the public domain.
pngparse was originally written by @ironwallaby
pngparse-sync port by Mikola Lysenko.