0.4.0 • Published 5 years ago

png.es v0.4.0

Weekly downloads
31
License
MIT
Repository
github
Last release
5 years ago

png.es

Build Status npm license

ECMAScript compliant lightweight PNG editor

Support

FunctionBitDepthTrueColorGrayScaleAlphaIndexedColorInterlace
parse1, 4, 6, 8oooox
pack1, 4, 6, 8oooxx

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);
0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.1

6 years ago

0.1.0

6 years ago