png.es
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

png.es

Build Status npm license

ECMAScript compliant lightweight PNG editor

Support

Function BitDepth TrueColor GrayScale Alpha IndexedColor Interlace
parse 1, 4, 6, 8 o o o o x
pack 1, 4, 6, 8 o o o x x

Distribution

npm

npm i png.es

files

for browser

for CommonJS

for ESModules

Usage

parse

import { parse } from 'png.es';

const pngObject = parse(rawData); // Input type is Uint8Array

pack

import { PNG, pack, COLOR_TYPE } from 'png.es';

// 4px * 4px RGBA image
const pngObject = new PNG(4, 4, COLOR_TYPE.RGBA);
pngObject.setData([255, 255, ....]);

const uint8Array = pack(pngObject);

edit

import { parse, pack } from 'png.es';

const pngObject = parse(rawData);
pngObject.setPixel(2, 2, [255, 0, 0, 255] ); // Set red to x2y2
const uint8Array = pack(pngObject);

Readme

Keywords

Package Sidebar

Install

npm i png.es

Weekly Downloads

13

Version

0.4.0

License

MIT

Unpacked Size

262 kB

Total Files

22

Last publish

Collaborators

  • zprodev