Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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