Skip to content

Commit

Permalink
fix name of dither function
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-moran committed Aug 27, 2015
1 parent 64182ba commit 7f5ddf0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Once the callback has fired, the following methods can be called on the image:
image.contrast( val ); // adjust the contrast by a value -1 to +1
image.posterize( n ); // apply a posterization effect with n level
image.mask( src, x, y ); // masks the image with another Jimp image at x, y using average pixel value
image.dither64(); // ordered dithering of the image and reduce color space to 64-bits (RGB565)
image.dither565(); // ordered dithering of the image and reduce color space to 16-bits (RGB565)

(Contributions of more methods are welcome!)

Expand Down
5 changes: 4 additions & 1 deletion jimp.js
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ Jimp.prototype.getBuffer = function (mime, cb) {
* @param (optional) cb A callback for when complete
* @returns this for chaining of methods
*/
Jimp.prototype.dither64 = function (cb) {
Jimp.prototype.dither565 = function (cb) {
var rgb565_matrix = [
0, 4, 1, 5, 0, 4, 1, 5,
6, 2, 7, 3, 6, 2, 7, 3,
Expand All @@ -984,6 +984,9 @@ Jimp.prototype.dither64 = function (cb) {
else return this;
}

// alternative reference
Jimp.prototype.dither16 = Jimp.prototype.dither565;

/**
* Writes the image to a file
* @param path a path to the destination file (either PNG or JPEG)
Expand Down
2 changes: 1 addition & 1 deletion test/callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var operations = {
"brightness": [0.75],
"contrast": [0.75],
"posterize": [5],
"dither64": []
"dither565": []
};

for (var op in operations) process(op);
Expand Down
2 changes: 1 addition & 1 deletion test/chained.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var lenna = new Jimp("lenna.png", function (err) {
lenna.clone().mask(mask, 0, 0).write("./output/lenna-mask.png");
});

this.clone().dither64().write("./output/lenna-64-bit.png");
this.clone().dither565().write("./output/lenna-565-bit.png");


});

0 comments on commit 7f5ddf0

Please sign in to comment.