New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pngjs-image

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pngjs-image - npm Package Compare versions

Comparing version 0.9.3 to 0.10.0

.editorconfig

460

index.js

@@ -1,15 +0,12 @@

// Copyright 2014, Yahoo! Inc.
// Copyright 2014-2015, Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.
var fs = require('fs'),
_ = require('underscore'),
_ = require('underscore'),
PNG = require('pngjs').PNG,
pixel = require('./lib/pixel'),
conversion = require('./lib/conversion'),
filters = require('./lib/filters'),
streamBuffers = require("stream-buffers");
PNG = require('pngjs').PNG,
pixel = require('./lib/pixel'),
conversion = require('./lib/conversion'),
filters = require('./lib/filters'),
streamBuffers = require("stream-buffers");
/**

@@ -22,7 +19,7 @@ * PNGjs-image class

*/
function PNGImage(image) {
image.on('error', function (err) {
this.log(err.message);
}.bind(this));
this._image = image;
function PNGImage (image) {
image.on('error', function (err) {
PNGImage.log(err.message);
});
this._image = image;
}

@@ -57,7 +54,7 @@

PNGImage.setFilter = function (key, fn) {
if (fn) {
this.filters[key] = fn;
} else {
delete this.filters[key];
}
if (fn) {
this.filters[key] = fn;
} else {
delete this.filters[key];
}
};

@@ -76,7 +73,7 @@

PNGImage.createImage = function (width, height) {
var image = new PNG({
width: width,
height: height
});
return new PNGImage(image);
var image = new PNG({
width: width,
height: height
});
return new PNGImage(image);
};

@@ -93,5 +90,5 @@

PNGImage.copyImage = function (image) {
var newImage = this.createImage(image.getWidth(), image.getHeight());
image.getImage().bitblt(newImage.getImage(), 0, 0, image.getWidth(), image.getHeight(), 0, 0);
return newImage;
var newImage = this.createImage(image.getWidth(), image.getHeight());
image.getImage().bitblt(newImage.getImage(), 0, 0, image.getWidth(), image.getHeight(), 0, 0);
return newImage;
};

@@ -109,16 +106,18 @@

PNGImage.readImage = function (filename, fn) {
var image = new PNG(),
resultImage = new PNGImage(image);
var image = new PNG(),
resultImage = new PNGImage(image);
fn = fn || function () {};
fn = fn || function () {};
fs.createReadStream(filename).pipe(image).once('parsed', function () {
image.removeListener('error', fn);
fn(undefined, resultImage);
}).once('error', function (err) {
image.removeListener('parsed', fn);
fn(err, resultImage);
});
fs.createReadStream(filename).once('error', function(err) {
fn(err, undefined);
}).pipe(image).once('parsed', function () {
image.removeListener('error', fn);
fn(undefined, resultImage);
}).once('error', function (err) {
image.removeListener('parsed', fn);
fn(err, resultImage);
}).pipe(image);
return resultImage;
return resultImage;
};

@@ -136,16 +135,16 @@

PNGImage.loadImage = function (blob, fn) {
var image = new PNG(),
resultImage = new PNGImage(image);
var image = new PNG(),
resultImage = new PNGImage(image);
fn = fn || function () {};
fn = fn || function () {};
image.once('error', function (err) {
fn(err, resultImage);
});
image.parse(blob, function () {
image.removeListener('error', fn);
fn(undefined, resultImage);
});
image.once('error', function (err) {
fn(err, resultImage);
});
image.parse(blob, function () {
image.removeListener('error', fn);
fn(undefined, resultImage);
});
return resultImage;
return resultImage;
};

@@ -161,3 +160,3 @@

PNGImage.log = function (text) {
// Nothing yet; Overwrite this when needed
// Nothing yet; Overwrite this when needed
};

@@ -167,217 +166,218 @@

/**
* Gets the original png-js object
*
* @method getImage
* @return {PNG}
*/
getImage: function () {
return this._image;
},
/**
* Gets the original png-js object
*
* @method getImage
* @return {PNG}
*/
getImage: function () {
return this._image;
},
/**
* Gets the image as a blob
*
* @method getBlob
* @return {Buffer}
*/
getBlob: function () {
return this._image.data;
},
/**
* Gets the image as a blob
*
* @method getBlob
* @return {Buffer}
*/
getBlob: function () {
return this._image.data;
},
/**
* Gets the width of the image
*
* @method getWidth
* @return {int}
*/
getWidth: function () {
return this._image.width;
},
/**
* Gets the width of the image
*
* @method getWidth
* @return {int}
*/
getWidth: function () {
return this._image.width;
},
/**
* Gets the height of the image
*
* @method getHeight
* @return {int}
*/
getHeight: function () {
return this._image.height;
},
/**
* Gets the height of the image
*
* @method getHeight
* @return {int}
*/
getHeight: function () {
return this._image.height;
},
/**
* Clips the current image by modifying it in-place
*
* @method clip
* @param {int} x Starting x-coordinate
* @param {int} y Starting y-coordinate
* @param {int} width Width of area relative to starting coordinate
* @param {int} height Height of area relative to starting coordinate
*/
clip: function (x, y, width, height) {
/**
* Clips the current image by modifying it in-place
*
* @method clip
* @param {int} x Starting x-coordinate
* @param {int} y Starting y-coordinate
* @param {int} width Width of area relative to starting coordinate
* @param {int} height Height of area relative to starting coordinate
*/
clip: function (x, y, width, height) {
var image;
var image;
width = Math.min(width, this.getWidth() - x);
height = Math.min(height, this.getHeight() - y);
width = Math.min(width, this.getWidth() - x);
height = Math.min(height, this.getHeight() - y);
if ((width < 0) || (height < 0)) {
throw new Error('Width and height cannot be negative.');
}
if ((width < 0) || (height < 0)) {
throw new Error('Width and height cannot be negative.');
}
image = new PNG({
width: width,
height: height
});
image = new PNG({
width: width, height: height
});
this._image.bitblt(image, x, y, width, height, 0, 0);
this._image = image;
},
this._image.bitblt(image, x, y, width, height, 0, 0);
this._image = image;
},
/**
* Fills an area with the specified color
*
* @method fillRect
* @param {int} x Starting x-coordinate
* @param {int} y Starting y-coordinate
* @param {int} width Width of area relative to starting coordinate
* @param {int} height Height of area relative to starting coordinate
* @param {object} color
* @param {int} [color.red] Red channel of color to set
* @param {int} [color.green] Green channel of color to set
* @param {int} [color.blue] Blue channel of color to set
* @param {int} [color.alpha] Alpha channel for color to set
* @param {float} [color.opacity] Opacity of color
*/
fillRect: function (x, y, width, height, color) {
var i, iLen = x + width,
j, jLen = y + height,
index;
/**
* Fills an area with the specified color
*
* @method fillRect
* @param {int} x Starting x-coordinate
* @param {int} y Starting y-coordinate
* @param {int} width Width of area relative to starting coordinate
* @param {int} height Height of area relative to starting coordinate
* @param {object} color
* @param {int} [color.red] Red channel of color to set
* @param {int} [color.green] Green channel of color to set
* @param {int} [color.blue] Blue channel of color to set
* @param {int} [color.alpha] Alpha channel for color to set
* @param {float} [color.opacity] Opacity of color
*/
fillRect: function (x, y, width, height, color) {
for (i = x; i < iLen; i++) {
for (j = y; j < jLen; j++) {
index = this.getIndex(i, j);
this.setAtIndex(index, color);
}
}
},
var i,
iLen = x + width,
j,
jLen = y + height,
index;
for (i = x; i < iLen; i++) {
for (j = y; j < jLen; j++) {
index = this.getIndex(i, j);
this.setAtIndex(index, color);
}
}
},
/**
* Applies a list of filters to the image
*
* @method applyFilters
* @param {string|object|object[]} filters Names of filters in sequence `{key:<string>, options:<object>}`
* @param {boolean} [returnResult=false]
* @return {PNGImage}
*/
applyFilters: function (filters, returnResult) {
var image,
newFilters;
/**
* Applies a list of filters to the image
*
* @method applyFilters
* @param {string|object|object[]} filters Names of filters in sequence `{key:<string>, options:<object>}`
* @param {boolean} [returnResult=false]
* @return {PNGImage}
*/
applyFilters: function (filters, returnResult) {
// Convert to array
if (_.isString(filters)) {
filters = [filters];
} else if (!_.isArray(filters) && _.isObject(filters)) {
filters = [filters];
}
var image,
newFilters;
// Format array as needed by the function
newFilters = [];
_.each(filters, function (filter) {
// Convert to array
if (_.isString(filters)) {
filters = [filters];
} else if (!_.isArray(filters) && _.isObject(filters)) {
filters = [filters];
}
if (_.isString(filter)) {
newFilters.push({ key: filter, options: {} });
// Format array as needed by the function
newFilters = [];
(filters || []).forEach(function (filter) {
} else if (_.isObject(filter)) {
newFilters.push(filter);
}
});
filters = newFilters;
if (_.isString(filter)) {
newFilters.push({key: filter, options: {}});
// Process filters
image = this;
_.each(filters, function (filter) {
} else if (_.isObject(filter)) {
newFilters.push(filter);
}
});
filters = newFilters;
var currentFilter = PNGImage.filters[filter.key];
// Process filters
image = this;
(filters || []).forEach(function (filter) {
if (!currentFilter) {
throw new Error('Unknown filter ' + filter.key);
}
var currentFilter = PNGImage.filters[filter.key];
filter.options = filter.options || {};
filter.options.needsCopy = !!returnResult;
if (!currentFilter) {
throw new Error('Unknown filter ' + filter.key);
}
image = currentFilter(this, filter.options);
filter.options = filter.options || {};
filter.options.needsCopy = !!returnResult;
}, this);
image = currentFilter(this, filter.options);
// Overwrite current image, or just returning it
if (!returnResult) {
this._image = image.getImage();
}
}.bind(this));
return image;
},
// Overwrite current image, or just returning it
if (!returnResult) {
this._image = image.getImage();
}
return image;
},
/**
* Gets index of a specific coordinate
*
* @method getIndex
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Index of pixel
*/
getIndex: function (x, y) {
return (this.getWidth() * y) + x;
},
/**
* Gets index of a specific coordinate
*
* @method getIndex
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Index of pixel
*/
getIndex: function (x, y) {
return (this.getWidth() * y) + x;
},
/**
* Writes the image to the filesystem
*
* @method writeImage
* @param {string} filename Path to file
* @param {function} fn Callback
*/
writeImage: function (filename, fn) {
fn = fn || function () {};
/**
* Writes the image to the filesystem
*
* @method writeImage
* @param {string} filename Path to file
* @param {function} fn Callback
*/
writeImage: function (filename, fn) {
this._image.pack().pipe(fs.createWriteStream(filename)).once('close', function () {
this._image.removeListener('error', fn);
fn(undefined, this);
}.bind(this)).once('error', function (err) {
this._image.removeListener('close', fn);
fn(err, this);
}.bind(this));
},
fn = fn || function () {};
/**
* Writes the image to a buffer
*
* @method toBlob
* @param {function} fn Callback
*/
toBlob: function (fn) {
this._image.pack().pipe(fs.createWriteStream(filename)).once('close', function () {
this._image.removeListener('error', fn);
fn(undefined, this);
}.bind(this)).once('error', function (err) {
this._image.removeListener('close', fn);
fn(err, this);
}.bind(this));
},
var writeBuffer = new streamBuffers.WritableStreamBuffer({
initialSize: (100 * 1024),
incrementAmount: (10 * 1024)
});
/**
* Writes the image to a buffer
*
* @method toBlob
* @param {function} fn Callback
*/
toBlob: function (fn) {
fn = fn || function () {};
var writeBuffer = new streamBuffers.WritableStreamBuffer({
initialSize: (100 * 1024), incrementAmount: (10 * 1024)
});
this._image.pack().pipe(writeBuffer).once('close', function () {
this._image.removeListener('error', fn);
fn(undefined, writeBuffer.getContents());
}.bind(this)).once('error', function (err) {
this._image.removeListener('close', fn);
fn(err);
}.bind(this));
}
fn = fn || function () {};
this._image.pack().pipe(writeBuffer).once('close', function () {
this._image.removeListener('error', fn);
fn(undefined, writeBuffer.getContents());
}.bind(this)).once('error', function (err) {
this._image.removeListener('close', fn);
fn(err);
}.bind(this));
}
};

@@ -393,6 +393,6 @@ PNGImage.prototype.constructor = PNGImage;

// Adds all standard filters
_.each(_.keys(filters), function (key) {
PNGImage.setFilter(key, filters[key]);
_.keys(filters).forEach(function (key) {
PNGImage.setFilter(key, filters[key]);
});
module.exports = PNGImage;

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -12,257 +12,261 @@

/**
* Gets the blurred value of a pixel with a gray-scale function
*
* @method getBlurPixelAtIndex
* @param {int} idx Index
* @param {string} [funcName] Gray-scale function
* @return {int}
*/
getBlurPixelAtIndex: function (idx, funcName) {
var colors = 0,
colorCounter = 0,
fn,
width = this._image.width,
height = this._image.height,
dim = width * height,
spaceOnRight,
spaceOnLeft,
spaceOnTop,
spaceOnBottom;
/**
* Gets the blurred value of a pixel with a gray-scale function
*
* @method getBlurPixelAtIndex
* @param {int} idx Index
* @param {string} [funcName] Gray-scale function
* @return {int}
*/
getBlurPixelAtIndex: function (idx, funcName) {
funcName = funcName || "getLuminosityAtIndex";
var colors = 0,
colorCounter = 0,
fn,
width = this._image.width,
height = this._image.height,
dim = width * height,
spaceOnRight,
spaceOnLeft,
spaceOnTop,
spaceOnBottom;
fn = function (idx) {
colors += this[funcName](idx);
colorCounter++;
}.bind(this);
funcName = funcName || "getLuminosityAtIndex";
spaceOnRight = (idx % width < width - 1);
spaceOnLeft = (idx % width > 0);
spaceOnTop = (idx >= width);
spaceOnBottom = (idx <= dim - width);
fn = function (idx) {
colors += this[funcName](idx);
colorCounter++;
}.bind(this);
if (spaceOnTop) {
if (spaceOnLeft) {
fn(idx - this._image.width - 1);
}
fn(idx - this._image.width);
if (spaceOnRight) {
fn(idx - this._image.width + 1);
}
}
spaceOnRight = (idx % width < width - 1);
spaceOnLeft = (idx % width > 0);
spaceOnTop = (idx >= width);
spaceOnBottom = (idx <= dim - width);
if (spaceOnLeft) {
fn(idx - 1);
}
fn(idx);
if (spaceOnRight) {
fn(idx + 1);
}
if (spaceOnTop) {
if (spaceOnLeft) {
fn(idx - this._image.width - 1);
}
fn(idx - this._image.width);
if (spaceOnRight) {
fn(idx - this._image.width + 1);
}
}
if (spaceOnBottom) {
if (spaceOnLeft) {
fn(idx + this._image.width - 1);
}
fn(idx + this._image.width);
if (spaceOnRight) {
fn(idx + this._image.width + 1);
}
}
if (spaceOnLeft) {
fn(idx - 1);
}
fn(idx);
if (spaceOnRight) {
fn(idx + 1);
}
return Math.floor(colors / colorCounter);
},
if (spaceOnBottom) {
if (spaceOnLeft) {
fn(idx + this._image.width - 1);
}
fn(idx + this._image.width);
if (spaceOnRight) {
fn(idx + this._image.width + 1);
}
}
/**
* Gets the blur-value of a pixel at a specific coordinate
*
* @method getBlurPixel
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @param {string} [funcName] Gray-scale function
* @return {int} blur-value
*/
getBlurPixel: function (x, y, funcName) {
var idx = this.getIndex(x, y);
return this.getBlurPixelAtIndex(idx, funcName);
},
return Math.floor(colors / colorCounter);
},
/**
* Gets the blur-value of a pixel at a specific coordinate
*
* @method getBlurPixel
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @param {string} [funcName] Gray-scale function
* @return {int} blur-value
*/
getBlurPixel: function (x, y, funcName) {
var idx = this.getIndex(x, y);
return this.getBlurPixelAtIndex(idx, funcName);
},
/**
* Gets the YIQ-value of a pixel at a specific index
* The values for RGB correspond afterwards to YIQ respectively.
*
* @method getYIQAtIndex
* @param {int} idx Index of pixel
* @return {object} YIQ-value
*/
getYIQAtIndex: function (idx) {
var r = this.getRed(idx),
g = this.getGreen(idx),
b = this.getBlue(idx),
y, i, q;
y = this.getLumaAtIndex(idx);
i = Math.floor((0.595716 * r) - (0.274453 * g) - (0.321263 * b));
q = Math.floor((0.211456 * r) - (0.522591 * g) + (0.311135 * b));
/**
* Gets the YIQ-value of a pixel at a specific index
* The values for RGB correspond afterwards to YIQ respectively.
*
* @method getYIQAtIndex
* @param {int} idx Index of pixel
* @return {object} YIQ-value
*/
getYIQAtIndex: function (idx) {
y = y < 0 ? 0 : (y > 255 ? 255 : y);
i = i < 0 ? 0 : (i > 255 ? 255 : i);
q = q < 0 ? 0 : (q > 255 ? 255 : q);
var r = this.getRed(idx),
g = this.getGreen(idx),
b = this.getBlue(idx),
y,
i,
q;
return { y:y, i:i, q:q };
},
y = this.getLumaAtIndex(idx);
i = Math.floor((0.595716 * r) - (0.274453 * g) - (0.321263 * b));
q = Math.floor((0.211456 * r) - (0.522591 * g) + (0.311135 * b));
/**
* Gets the YIQ-value of a pixel at a specific coordinate
* The values for RGB correspond afterwards to YIQ respectively.
*
* @method getYIQ
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {object} YIQ-value
*/
getYIQ: function (x, y) {
var idx = this.getIndex(x, y);
return this.getYIQAtIndex(idx);
},
y = y < 0 ? 0 : (y > 255 ? 255 : y);
i = i < 0 ? 0 : (i > 255 ? 255 : i);
q = q < 0 ? 0 : (q > 255 ? 255 : q);
return {y: y, i: i, q: q};
},
/**
* Gets the luma of a pixel at a specific index
*
* @method getLumaAtIndex
* @param {int} idx Index of pixel
* @return {int} YIQ-value
*/
getLumaAtIndex: function (idx) {
return Math.floor((0.299 * this.getRed(idx)) + (0.587 * this.getGreen(idx)) + (0.114 * this.getBlue(idx)));
},
/**
* Gets the YIQ-value of a pixel at a specific coordinate
* The values for RGB correspond afterwards to YIQ respectively.
*
* @method getYIQ
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {object} YIQ-value
*/
getYIQ: function (x, y) {
var idx = this.getIndex(x, y);
return this.getYIQAtIndex(idx);
},
/**
* Gets the luma of a pixel at a specific coordinate
*
* @method getLuma
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} YIQ-value
*/
getLuma: function (x, y) {
var idx = this.getIndex(x, y);
return this.getLumaAtIndex(idx);
},
/**
* Gets the sepia of a pixel at a specific index
*
* @method getSepiaAtIndex
* @param {int} idx Index of pixel
* @return {object} Color
*/
getSepiaAtIndex: function (idx) {
var r = this.getRed(idx),
g = this.getGreen(idx),
b = this.getBlue(idx);
/**
* Gets the luma of a pixel at a specific index
*
* @method getLumaAtIndex
* @param {int} idx Index of pixel
* @return {int} YIQ-value
*/
getLumaAtIndex: function (idx) {
return Math.floor((0.299 * this.getRed(idx)) + (0.587 * this.getGreen(idx)) + (0.114 * this.getBlue(idx)));
},
r = Math.floor((0.393 * r) + (0.769 * g) + (0.189 * b));
g = Math.floor((0.349 * r) + (0.686 * g) + (0.168 * b));
b = Math.floor((0.272 * r) + (0.534 * g) + (0.131 * b));
/**
* Gets the luma of a pixel at a specific coordinate
*
* @method getLuma
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} YIQ-value
*/
getLuma: function (x, y) {
var idx = this.getIndex(x, y);
return this.getLumaAtIndex(idx);
},
r = r < 0 ? 0 : (r > 255 ? 255 : r);
g = g < 0 ? 0 : (g > 255 ? 255 : g);
b = b < 0 ? 0 : (b > 255 ? 255 : b);
/**
* Gets the sepia of a pixel at a specific index
*
* @method getSepiaAtIndex
* @param {int} idx Index of pixel
* @return {object} Color
*/
getSepiaAtIndex: function (idx) {
var r = this.getRed(idx),
g = this.getGreen(idx),
b = this.getBlue(idx);
return { red:r, green:g, blue:b };
},
r = Math.floor((0.393 * r) + (0.769 * g) + (0.189 * b));
g = Math.floor((0.349 * r) + (0.686 * g) + (0.168 * b));
b = Math.floor((0.272 * r) + (0.534 * g) + (0.131 * b));
/**
* Gets the sepia of a pixel at a specific coordinate
*
* @method getSepia
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {object} Color
*/
getSepia: function (x, y) {
return this.getSepiaAtIndex(this.getIndex(x, y));
},
r = r < 0 ? 0 : (r > 255 ? 255 : r);
g = g < 0 ? 0 : (g > 255 ? 255 : g);
b = b < 0 ? 0 : (b > 255 ? 255 : b);
return {red: r, green: g, blue: b};
},
/**
* Gets the luminosity of a pixel at a specific index
*
* @method getLuminosityAtIndex
* @param {int} idx Index of pixel
* @return {int} Luminosity
*/
getLuminosityAtIndex: function (idx) {
return Math.floor((0.2126 * this.getRed(idx)) + (0.7152 * this.getGreen(idx)) + (0.0722 * this.getBlue(idx)));
},
/**
* Gets the sepia of a pixel at a specific coordinate
*
* @method getSepia
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {object} Color
*/
getSepia: function (x, y) {
return this.getSepiaAtIndex(this.getIndex(x, y));
},
/**
* Gets the luminosity of a pixel at a specific coordinate
*
* @method getLuminosity
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Luminosity
*/
getLuminosity: function (x, y) {
var idx = this.getIndex(x, y);
return this.getLuminosityAtIndex(idx);
},
/**
* Gets the luminosity of a pixel at a specific index
*
* @method getLuminosityAtIndex
* @param {int} idx Index of pixel
* @return {int} Luminosity
*/
getLuminosityAtIndex: function (idx) {
return Math.floor((0.2126 * this.getRed(idx)) + (0.7152 * this.getGreen(idx)) + (0.0722 * this.getBlue(idx)));
},
/**
* Gets the lightness of a pixel at a specific index
*
* @method getLightnessAtIndex
* @param {int} idx Index of pixel
* @return {int} Lightness
*/
getLightnessAtIndex: function (idx) {
var r = this.getRed(idx),
g = this.getGreen(idx),
b = this.getBlue(idx);
/**
* Gets the luminosity of a pixel at a specific coordinate
*
* @method getLuminosity
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Luminosity
*/
getLuminosity: function (x, y) {
var idx = this.getIndex(x, y);
return this.getLuminosityAtIndex(idx);
},
return Math.floor((Math.max(r, g, b) + Math.min(r, g, b)) / 2);
},
/**
* Gets the lightness of a pixel at a specific coordinate
*
* @method getLightness
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Lightness
*/
getLightness: function (x, y) {
var idx = this.getIndex(x, y);
return this.getLightnessAtIndex(idx);
},
/**
* Gets the lightness of a pixel at a specific index
*
* @method getLightnessAtIndex
* @param {int} idx Index of pixel
* @return {int} Lightness
*/
getLightnessAtIndex: function (idx) {
var r = this.getRed(idx),
g = this.getGreen(idx),
b = this.getBlue(idx);
return Math.floor((Math.max(r, g, b) + Math.min(r, g, b)) / 2);
},
/**
* Gets the average of a pixel at a specific index
*
* @method getGrayScaleAtIndex
* @param {int} idx Index of pixel
* @return {int} Average
*/
getGrayScaleAtIndex: function (idx) {
return Math.floor((this.getRed(idx) + this.getGreen(idx) + this.getBlue(idx)) / 3);
},
/**
* Gets the lightness of a pixel at a specific coordinate
*
* @method getLightness
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Lightness
*/
getLightness: function (x, y) {
var idx = this.getIndex(x, y);
return this.getLightnessAtIndex(idx);
},
/**
* Gets the average of a pixel at a specific coordinate
*
* @method getGrayScale
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Average
*/
getGrayScale: function (x, y) {
var idx = this.getIndex(x, y);
return this.getGrayScaleAtIndex(idx);
}
};
/**
* Gets the average of a pixel at a specific index
*
* @method getGrayScaleAtIndex
* @param {int} idx Index of pixel
* @return {int} Average
*/
getGrayScaleAtIndex: function (idx) {
return Math.floor((this.getRed(idx) + this.getGreen(idx) + this.getBlue(idx)) / 3);
},
/**
* Gets the average of a pixel at a specific coordinate
*
* @method getGrayScale
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Average
*/
getGrayScale: function (x, y) {
var idx = this.getIndex(x, y);
return this.getGrayScaleAtIndex(idx);
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -22,33 +22,33 @@

/**
* Creates a destination image
*
* @method
* @param {PNGImage} image
* @param {object} options
* @param {object} [options.needsCopy=false]
* @return {PNGImage}
*/
return function (image, options) {
/**
* Creates a destination image
*
* @method
* @param {PNGImage} image
* @param {object} options
* @param {object} [options.needsCopy=false]
* @return {PNGImage}
*/
return function (image, options) {
if (options.needsCopy) {
var newImage = image.constructor.createImage(image.getWidth(), image.getHeight());
fn(image, newImage, options);
return newImage;
if (options.needsCopy) {
var newImage = image.constructor.createImage(image.getWidth(), image.getHeight());
fn(image, newImage, options);
return newImage;
} else {
fn(image, image, options);
return image;
}
};
} else {
fn(image, image, options);
return image;
}
};
}
module.exports = {
"blur": generateFilter(blur),
"grayScale": generateFilter(grayScale),
"lightness": generateFilter(lightness),
"luma": generateFilter(luma),
"luminosity": generateFilter(luminosity),
"sepia": generateFilter(sepia)
"blur": generateFilter(blur),
"grayScale": generateFilter(grayScale),
"lightness": generateFilter(lightness),
"luma": generateFilter(luma),
"luminosity": generateFilter(luminosity),
"sepia": generateFilter(sepia)
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -16,14 +16,14 @@

var dim = source.getWidth() * source.getHeight(),
idx,
value;
var dim = source.getWidth() * source.getHeight(),
idx,
value;
for (idx = 0; idx < dim; idx++) {
value = source.getBlurPixelAtIndex(idx, options.funcName);
for (idx = 0; idx < dim; idx++) {
value = source.getBlurPixelAtIndex(idx, options.funcName);
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -15,14 +15,14 @@

var dim = source.getWidth() * source.getHeight(),
idx,
value;
var dim = source.getWidth() * source.getHeight(),
idx,
value;
for (idx = 0; idx < dim; idx++) {
value = source.getGrayScaleAtIndex(idx);
for (idx = 0; idx < dim; idx++) {
value = source.getGrayScaleAtIndex(idx);
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -15,14 +15,14 @@

var dim = source.getWidth() * source.getHeight(),
idx,
value;
var dim = source.getWidth() * source.getHeight(),
idx,
value;
for (idx = 0; idx < dim; idx++) {
value = source.getLightnessAtIndex(idx);
for (idx = 0; idx < dim; idx++) {
value = source.getLightnessAtIndex(idx);
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -15,14 +15,14 @@

var dim = source.getWidth() * source.getHeight(),
idx,
value;
var dim = source.getWidth() * source.getHeight(),
idx,
value;
for (idx = 0; idx < dim; idx++) {
value = source.getLumaAtIndex(idx);
for (idx = 0; idx < dim; idx++) {
value = source.getLumaAtIndex(idx);
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -15,14 +15,14 @@

var dim = source.getWidth() * source.getHeight(),
idx,
value;
var dim = source.getWidth() * source.getHeight(),
idx,
value;
for (idx = 0; idx < dim; idx++) {
value = source.getLuminosityAtIndex(idx);
for (idx = 0; idx < dim; idx++) {
value = source.getLuminosityAtIndex(idx);
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};
destination.setRed(idx, value);
destination.setGreen(idx, value);
destination.setBlue(idx, value);
destination.setAlpha(idx, source.getAlpha(idx));
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -15,11 +15,11 @@

var dim = source.getWidth() * source.getHeight(),
idx,
value;
var dim = source.getWidth() * source.getHeight(),
idx,
value;
for (idx = 0; idx < dim; idx++) {
value = source.getSepiaAtIndex(idx);
value.alpha = source.getAlpha(idx);
destination.setAtIndex(idx, value);
}
};
for (idx = 0; idx < dim; idx++) {
value = source.getSepiaAtIndex(idx);
value.alpha = source.getAlpha(idx);
destination.setAtIndex(idx, value);
}
};

@@ -1,2 +0,2 @@

// Copyright 2014 Yahoo! Inc.
// Copyright 2014-2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

@@ -12,269 +12,268 @@

/**
* Gets the color of a pixel at a specific index
*
* @method getPixel
* @param {int} idx Index of pixel
* @return {int} Color
*/
getAtIndex: function (idx) {
return this.getColorAtIndex(idx) | (this.getAlpha(idx) << 24);
},
/**
* Gets the color of a pixel at a specific index
*
* @method getPixel
* @param {int} idx Index of pixel
* @return {int} Color
*/
getAtIndex: function (idx) {
return this.getColorAtIndex(idx) | (this.getAlpha(idx) << 24);
},
/**
* Gets the color of a pixel at a specific coordinate
*
* @method getAt
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Color
*/
getAt: function (x, y) {
var idx = this.getIndex(x, y);
return this.getAtIndex(idx);
},
/**
* Gets the color of a pixel at a specific coordinate
*
* @method getAt
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Color
*/
getAt: function (x, y) {
var idx = this.getIndex(x, y);
return this.getAtIndex(idx);
},
/**
* Gets the color of a pixel at a specific coordinate
* Alias for getAt
*
* @method getPixel
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Color
*/
getPixel: function (x, y) {
return this.getAt(x, y);
},
/**
* Gets the color of a pixel at a specific coordinate
* Alias for getAt
*
* @method getPixel
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Color
*/
getPixel: function (x, y) {
return this.getAt(x, y);
},
/**
* Sets the color of a pixel at a specific index
*
* @method setAtIndex
* @param {int} idx Index of pixel
* @param {object} color
* @param {int} [color.red] Red value for pixel
* @param {int} [color.green] Green value for pixel
* @param {int} [color.blue] Blue value for pixel
* @param {int} [color.alpha] Alpha value for pixel
* @param {number} [color.opacity] Opacity of color
*/
setAtIndex: function (idx, color) {
if (color.red !== undefined) this.setRed(idx, color.red, color.opacity);
if (color.green !== undefined) this.setGreen(idx, color.green, color.opacity);
if (color.blue !== undefined) this.setBlue(idx, color.blue, color.opacity);
if (color.alpha !== undefined) this.setAlpha(idx, color.alpha, color.opacity);
},
/**
* Sets the color of a pixel at a specific index
*
* @method setAtIndex
* @param {int} idx Index of pixel
* @param {object} color
* @param {int} [color.red] Red value for pixel
* @param {int} [color.green] Green value for pixel
* @param {int} [color.blue] Blue value for pixel
* @param {int} [color.alpha] Alpha value for pixel
* @param {number} [color.opacity] Opacity of color
*/
setAtIndex: function (idx, color) {
if (color.red !== undefined) this.setRed(idx, color.red, color.opacity);
if (color.green !== undefined) this.setGreen(idx, color.green, color.opacity);
if (color.blue !== undefined) this.setBlue(idx, color.blue, color.opacity);
if (color.alpha !== undefined) this.setAlpha(idx, color.alpha, color.opacity);
},
/**
* Sets the color of a pixel at a specific coordinate
*
* @method setAt
* @param {int} x X-coordinate for pixel
* @param {int} y Y-coordinate for pixel
* @param {object} color
* @param {int} [color.red] Red value for pixel
* @param {int} [color.green] Green value for pixel
* @param {int} [color.blue] Blue value for pixel
* @param {int} [color.alpha] Alpha value for pixel
* @param {number} [color.opacity] Opacity of color
*/
setAt: function (x, y, color) {
var idx = this.getIndex(x, y);
this.setAtIndex(idx, color);
},
/**
* Sets the color of a pixel at a specific coordinate
*
* @method setAt
* @param {int} x X-coordinate for pixel
* @param {int} y Y-coordinate for pixel
* @param {object} color
* @param {int} [color.red] Red value for pixel
* @param {int} [color.green] Green value for pixel
* @param {int} [color.blue] Blue value for pixel
* @param {int} [color.alpha] Alpha value for pixel
* @param {number} [color.opacity] Opacity of color
*/
setAt: function (x, y, color) {
var idx = this.getIndex(x, y);
this.setAtIndex(idx, color);
},
/**
* Sets the color of a pixel at a specific coordinate
* Alias for setAt
*
* @method setPixel
* @param {int} x X-coordinate for pixel
* @param {int} y Y-coordinate for pixel
* @param {object} color
* @param {int} [color.red] Red value for pixel
* @param {int} [color.green] Green value for pixel
* @param {int} [color.blue] Blue value for pixel
* @param {int} [color.alpha] Alpha value for pixel
* @param {number} [color.opacity] Opacity of color
*/
setPixel: function (x, y, color) {
this.setAt(x, y, color);
},
/**
* Sets the color of a pixel at a specific coordinate
* Alias for setAt
*
* @method setPixel
* @param {int} x X-coordinate for pixel
* @param {int} y Y-coordinate for pixel
* @param {object} color
* @param {int} [color.red] Red value for pixel
* @param {int} [color.green] Green value for pixel
* @param {int} [color.blue] Blue value for pixel
* @param {int} [color.alpha] Alpha value for pixel
* @param {number} [color.opacity] Opacity of color
*/
setPixel: function (x, y, color) {
this.setAt(x, y, color);
},
/**
* Gets the color of a pixel at a specific index
*
* @method getColorAtIndex
* @param {int} idx Index of pixel
* @return {int} Color
*/
getColorAtIndex: function (idx) {
return this.getRed(idx) | (this.getGreen(idx) << 8) | (this.getBlue(idx) << 16);
},
/**
* Gets the color of a pixel at a specific index
*
* @method getColorAtIndex
* @param {int} idx Index of pixel
* @return {int} Color
*/
getColorAtIndex: function (idx) {
return this.getRed(idx) | (this.getGreen(idx) << 8) | (this.getBlue(idx) << 16);
},
/**
* Gets the color of a pixel at a specific coordinate
*
* @method getColor
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Color
*/
getColor: function (x, y) {
var idx = this.getIndex(x, y);
return this.getColorAtIndex(idx);
},
/**
* Gets the color of a pixel at a specific coordinate
*
* @method getColor
* @param {int} x X-coordinate of pixel
* @param {int} y Y-coordinate of pixel
* @return {int} Color
*/
getColor: function (x, y) {
var idx = this.getIndex(x, y);
return this.getColorAtIndex(idx);
},
/**
* Calculates the final color value for opacity
*
* @method _calculateColorValue
* @param {int} originalValue
* @param {int} paintValue
* @param {number} [opacity]
* @return {int}
* @private
*/
_calculateColorValue: function (originalValue, paintValue, opacity) {
/**
* Calculates the final color value for opacity
*
* @method _calculateColorValue
* @param {int} originalValue
* @param {int} paintValue
* @param {number} [opacity]
* @return {int}
* @private
*/
_calculateColorValue: function (originalValue, paintValue, opacity) {
var originalPart,
paintPart;
var originalPart, paintPart;
if (opacity === undefined) {
return paintValue;
} else {
originalPart = originalValue * (1 - opacity);
paintPart = (paintValue * opacity);
if (opacity === undefined) {
return paintValue;
} else {
originalPart = originalValue * (1 - opacity);
paintPart = (paintValue * opacity);
return Math.floor(originalPart + paintPart);
}
},
return Math.floor(originalPart + paintPart);
}
},
/**
* Get the red value of a pixel
*
* @method getRed
* @param {int} idx Index of pixel
* @return {int}
*/
getRed: function (idx) {
return this._getValue(idx << 2, 0);
},
/**
* Get the red value of a pixel
*
* @method getRed
* @param {int} idx Index of pixel
* @return {int}
*/
getRed: function (idx) {
return this._getValue(idx << 2, 0);
},
/**
* Set the red value of a pixel
*
* @method setRed
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setRed: function (idx, value, opacity) {
this._setValue(idx << 2, 0, value, opacity);
},
/**
* Set the red value of a pixel
*
* @method setRed
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setRed: function (idx, value, opacity) {
this._setValue(idx << 2, 0, value, opacity);
},
/**
* Get the green value of a pixel
*
* @method getGreen
* @param {int} idx Index of pixel
* @return {int}
*/
getGreen: function (idx) {
return this._getValue(idx << 2, 1);
},
/**
* Get the green value of a pixel
*
* @method getGreen
* @param {int} idx Index of pixel
* @return {int}
*/
getGreen: function (idx) {
return this._getValue(idx << 2, 1);
},
/**
* Set the green value of a pixel
*
* @method setGreen
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setGreen: function (idx, value, opacity) {
this._setValue(idx << 2, 1, value, opacity);
},
/**
* Set the green value of a pixel
*
* @method setGreen
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setGreen: function (idx, value, opacity) {
this._setValue(idx << 2, 1, value, opacity);
},
/**
* Get the blue value of a pixel
*
* @method getBlue
* @param {int} idx Index of pixel
* @return {int}
*/
getBlue: function (idx) {
return this._getValue(idx << 2, 2);
},
/**
* Get the blue value of a pixel
*
* @method getBlue
* @param {int} idx Index of pixel
* @return {int}
*/
getBlue: function (idx) {
return this._getValue(idx << 2, 2);
},
/**
* Set the blue value of a pixel
*
* @method setBlue
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setBlue: function (idx, value, opacity) {
this._setValue(idx << 2, 2, value, opacity);
},
/**
* Set the blue value of a pixel
*
* @method setBlue
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setBlue: function (idx, value, opacity) {
this._setValue(idx << 2, 2, value, opacity);
},
/**
* Get the alpha value of a pixel
*
* @method getAlpha
* @param {int} idx Index of pixel
* @return {int}
*/
getAlpha: function (idx) {
return this._getValue(idx << 2, 3);
},
/**
* Get the alpha value of a pixel
*
* @method getAlpha
* @param {int} idx Index of pixel
* @return {int}
*/
getAlpha: function (idx) {
return this._getValue(idx << 2, 3);
},
/**
* Set the alpha value of a pixel
*
* @method setAlpha
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setAlpha: function (idx, value, opacity) {
this._setValue(idx << 2, 3, value, opacity);
},
/**
* Set the alpha value of a pixel
*
* @method setAlpha
* @param {int} idx Index of pixel
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
*/
setAlpha: function (idx, value, opacity) {
this._setValue(idx << 2, 3, value, opacity);
},
/**
* Sets the value of a pixel
*
* @method _getValue
* @param {int} offset Offset of a value
* @param {int} colorOffset Offset of a color
* @return {int}
* @private
*/
_getValue: function (offset, colorOffset) {
return this._image.data[offset + colorOffset];
},
/**
* Sets the value of a pixel
*
* @method _getValue
* @param {int} offset Offset of a value
* @param {int} colorOffset Offset of a color
* @return {int}
* @private
*/
_getValue: function (offset, colorOffset) {
return this._image.data[offset + colorOffset];
},
/**
* Sets the value of a pixel
*
* @method _setValue
* @param {int} offset Offset of a value
* @param {int} colorOffset Offset of a color
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
* @private
*/
_setValue: function (offset, colorOffset, value, opacity) {
var previousValue = this._getValue(offset, colorOffset);
this._image.data[offset + colorOffset] = this._calculateColorValue(previousValue, value, opacity);
}
};
/**
* Sets the value of a pixel
*
* @method _setValue
* @param {int} offset Offset of a value
* @param {int} colorOffset Offset of a color
* @param {int} value Value for pixel
* @param {number} [opacity] Opacity of value set
* @private
*/
_setValue: function (offset, colorOffset, value, opacity) {
var previousValue = this._getValue(offset, colorOffset);
this._image.data[offset + colorOffset] = this._calculateColorValue(previousValue, value, opacity);
}
};
{
"name": "pngjs-image",
"version": "0.9.3",
"description": "Native PNG image manipulation",
"license": "MIT",
"main": "index.js",
"homepage": "https://github.com/yahoo/pngjs-image",
"bugs": "https://github.com/yahoo/pngjs-image/issues",
"author": {
"name": "Marcel Erz",
"email": "erz@yahoo-inc.com"
},
"repository": {
"type": "git",
"url": "https://github.com/yahoo/pngjs-image.git"
},
"keywords": [
"PNG",
"image",
"manipulation"
],
"scripts": {
"test": "istanbul cover -- _mocha --reporter spec",
"docs": "yuidoc ."
},
"dependencies": {
"pngjs": "0.4.0",
"stream-buffers": "1.0.1",
"underscore": "1.7.0"
},
"devDependencies": {
"chai": "1.9.1",
"istanbul": "0.3.2",
"mocha": "1.21.4",
"yuidocjs": "0.3.50"
}
"name": "pngjs-image",
"version": "0.10.0",
"description": "Native PNG image manipulation",
"license": "MIT",
"main": "index.js",
"homepage": "https://github.com/yahoo/pngjs-image",
"bugs": "https://github.com/yahoo/pngjs-image/issues",
"author": {
"name": "Marcel Erz",
"email": "erz@yahoo-inc.com",
"url": "http://www.marcelerz.com"
},
"repository": {
"type": "git",
"url": "https://github.com/yahoo/pngjs-image.git"
},
"keywords": [
"PNG",
"image",
"manipulation",
"filter",
"alpha"
],
"scripts": {
"test": "istanbul cover -- _mocha --reporter spec",
"docs": "yuidoc ."
},
"dependencies": {
"pngjs": "0.4.0",
"stream-buffers": "1.0.1",
"underscore": "1.7.0"
},
"devDependencies": {
"chai": "1.9.2",
"coveralls": "2.11.2",
"codeclimate-test-reporter": "0.0.4",
"istanbul": "0.3.2",
"mocha": "1.21.4",
"sinon": "1.12.2",
"sinon-chai": "2.7.0",
"yuidocjs": "0.3.50"
}
}

@@ -6,3 +6,31 @@ PNGjs-Image

[![Build Status](https://img.shields.io/travis/yahoo/pngjs-image.svg)](http://travis-ci.org/yahoo/pngjs-image)
[![Coveralls Coverage](https://img.shields.io/coveralls/yahoo/pngjs-image.svg)](https://coveralls.io/r/yahoo/pngjs-image)
[![Code Climate Grade](https://img.shields.io/codeclimate/github/yahoo/pngjs-image.svg)](https://codeclimate.com/github/yahoo/pngjs-image)
[![NPM version](https://badge.fury.io/js/pngjs-image.svg)](https://www.npmjs.com/package/pngjs-image)
[![NPM License](https://img.shields.io/npm/l/pngjs-image.svg)](https://www.npmjs.com/package/pngjs-image)
[![NPM](https://nodei.co/npm/pngjs-image.png?downloads=true&stars=true)](https://www.npmjs.com/package/pngjs-image)
[![NPM](https://nodei.co/npm-dl/pngjs-image.png?months=3&height=2)](https://www.npmjs.com/package/pngjs-image)
[![Coverage Report](https://img.shields.io/badge/Coverage_Report-Available-blue.svg)](http://yahoo.github.io/pngjs-image/coverage/lcov-report/)
[![API Documentation](https://img.shields.io/badge/API_Documentation-Available-blue.svg)](http://yahoo.github.io/pngjs-image/docs/)
[![Gitter Support](https://img.shields.io/badge/Support-Gitter_IM-yellow.svg)](https://gitter.im/preceptorjs/support)
**Table of Contents**
* [Installation](#installation)
* [Usage](#usage)
* [Static-Methods](#static-methods)
* [Instance-Methods](#instance-methods)
* [Pixel manipulation](#pixel-manipulation)
* [Pixel conversion](#pixel-conversion)
* [Filters](#filters)
* [API-Documentation](#api-documentation)
* [Tests](#tests)
* [Third-party libraries](#third-party-libraries)
* [License](#license)
##Installation

@@ -157,2 +185,4 @@

* chai: http://chaijs.com
* codeclimate-test-reporter: https://github.com/codeclimate/javascript-test-reporter
* coveralls: https://github.com/cainus/node-coveralls
* istanbul: https://github.com/gotwarlost/istanbul

@@ -166,2 +196,2 @@ * mocha: https://github.com/visionmedia/mocha

Copyright 2014 Yahoo Inc.
Copyright 2014-2015 Yahoo Inc.
{
"options": {
"outdir": "docs",
"linkNatives": true,
"exclude": "test"
}
}
"options": {
"outdir": "docs",
"linkNatives": true,
"exclude": "test"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc