How to use the pngjs.PNG.prototype function in pngjs

To help you get started, we’ve selected a few pngjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GridSpace / grid-host / src / image.js View on Github external
const BMP   = require('bmp-js');
const PNG   = require('pngjs').PNG;

PNG.prototype.pixAt = function(x,y) {
    let idx = (x + this.width * y) * 4;
    let dat = this.data;
    return [
        dat[idx++],
        dat[idx++],
        dat[idx++],
        dat[idx++]
    ];
};

PNG.prototype.averageBlock = function(x1,y1,x2,y2) {
    let val = [0, 0, 0, 0];
    let count = 0;
    for (let x=x1; x
github GridSpace / grid-host / src / image.js View on Github external
const BMP   = require('bmp-js');
const PNG   = require('pngjs').PNG;

PNG.prototype.pixAt = function(x,y) {
    let idx = (x + this.width * y) * 4;
    let dat = this.data;
    return [
        dat[idx++],
        dat[idx++],
        dat[idx++],
        dat[idx++]
    ];
};

PNG.prototype.averageBlock = function(x1,y1,x2,y2) {
    let val = [0, 0, 0, 0];
    let count = 0;
    for (let x=x1; x

pngjs

PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis