@houshuang/parse-png

Parse a PNG

Stats

StarsIssuesVersionUpdatedCreatedSize
@houshuang/parse-png
1.1.44 years ago4 years agoMinified + gzip package size for @houshuang/parse-png in KB

Readme

parse-png Build Status

Parse a PNG

Install

$ npm install --save parse-png

Usage

const fs = require('fs');
const parsePng = require('parse-png');

parsePng(fs.readFileSync('unicorn.png')).then(png => {
    console.log(png);
    /*
    {
        width: 200,
        height: 133,
        depth: 8,
        interlace: false,
        palette: false,
        color: true,
        alpha: false,
        bpp: 3,
        colorType: 2,
        data: <Buffer 29 48 4d ...>,
    }
    */

    png.adjustGamma();
    png.pack().pipe(fs.createWriteStream('unicorn-adjusted.png'));
});

API

parsePng(buffer, [options])

Returns a promise for a PNG instance. See the pngjs documentation for more information.

buffer

Type: buffer

A PNG image buffer.

options

Type: object

See the pngjs options.

License

MIT © Kevin Martensson

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.