GT2/Ejectable/node_modules/parse-png
Ren Juan 06c1a5835d set clean start from expo 4.10 2021-08-16 00:14:59 +00:00
..
node_modules/pngjs set clean start from expo 4.10 2021-08-16 00:14:59 +00:00
index.d.ts set clean start from expo 4.10 2021-08-16 00:14:59 +00:00
index.js set clean start from expo 4.10 2021-08-16 00:14:59 +00:00
license set clean start from expo 4.10 2021-08-16 00:14:59 +00:00
package.json set clean start from expo 4.10 2021-08-16 00:14:59 +00:00
readme.md set clean start from expo 4.10 2021-08-16 00:14:59 +00:00

readme.md

parse-png Build Status

Parse a PNG

Install

$ npm install parse-png

Usage

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

(async () => {
	const png = await parsePng(fs.readFileSync('unicorn.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<Object> with a PNG instance. See the pngjs documentation for more information.

buffer

Type: Buffer

A PNG image buffer.

options

Type: Object

See the pngjs options.