Feb 24, 2013 in jQuery, Javascript
Below is javascript implementation of Floyd-Steinberg dithering algorithm to convert image into two-color (black and white) version. I wrapped the code in form of jQuery plugin however it can be extracted to to separate function.
The list of possible settings includes:
Here is a some possible usage example:
$('#image').imageHalftone({
output: 'image'
});
The example above will process image with id image
and replace it with new converted version (image).
$('#image').imageHalftone({
output: 'image',
target: function($new) {
$new.appendTo('body');
}
});
This example with not replace original image but instead will append new image to body
.
comments powered by Disqus