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