pingy
PNG creation and manipulation helper for node-pngjs.
Installation
$ npm install pingy
Usage
var Pingy = ;
Creation
Create a new, empty Pingy object of width 64px and height 48px:
var img = 64 48; // default color is black
Create a Pingy object from an existing pngjs object:
var img2 = obj;
Create a Pingy object from an array of sparse RGBA values:
var img3 = r: 255 r: 128 b: 128 g: 255 a: 192 b: 128 b: 192 b: 256 ;
Create a Pingy object from ASCII art:
// whatever *that* is supposed to be ...var art = '' + 'O------O\n' + '| |\n' + '| **** |\n' + '| |\n' + 'O------O'; var img4 = art 'O': r: 128 '-': b: 128 // characters without mappings get a random color;
Manipulation
Execute a function on each point of an image:
img;
Get the color at a point:
img;// returns { r:255, g:0, b:0, a:255 };
Set the color at a point by passing a sparse RGBA object:
img;// returns { r: 255, g: 255, b: 128, a: 255 };
Enlarge an image linearly:
img;
Utility
Get width of the image:
img;// returns 64
Get height of the image:
img;// returns 48
Get the base 64 representation of an image:
img;
Get the base 64 string as a data URI:
img;
License
This software is released under the terms of the MIT license. See LICENSE
.