Narnia's Psychedelic Mushrooms
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    micropngpublic

    node-micropng

    A tiny pixel manipulation helper for node.js using pngjs. It also includes the option to write a png image directly to a server for quick testing and prototyping.

    Installation

    npm install micropng

    API documentation

    constructor

    var MicroPNG = require('micropng');
    var png = new MicroPNG(200, 200); // new png of width and height 200 

    point

    Paints a pixel a particular color

    png.point(5, 5, [50,50,50]); // at (5, 5) make a point with RGB value of 50,50,50 

    background

    Fills entire image with a color

    png.background([255,255,255]);

    rect

    png.rect(0, 0, 200, 200, [200, 40, 40]); // unfilled red rectangle from (0,0) to (200,200) 
    png.rect(0, 0, 200, 200, [70, 70, 70], true); // filled grey rectangle 
    png.rect(0, 0, 200, 200, [70, 70, 70], true, [200,0,0]); // grey rectangle with red fill 

    exportFile

    Exports the image to a file

    png.exportFile(__dirname + '/image.png');

    exportServer

    Runs a local server on a given port serving the image

    png.exportServer(8084);

    Keywords

    none

    install

    npm i micropng

    Downloadsweekly downloads

    3

    version

    0.1.0

    license

    none

    last publish

    collaborators

    • avatar