A minimalist image filter library for javascript
The following filters have been implemented:
- greyscale (using luminance)
- sepia (using w3c filters sepia definition)
- popart (still in development)
- vivid (makes the colors more vivid)
- polaroid (makes the photo a bit overexposed like if it had been taken with a polaroid)
Replace an image by a filtered version:
var image = document.getElementById('my-image');
var filteredCanvas = leonardo.applyFilter(image, 'greyscale');
image.src = filteredCanvas.toDataURL();
var Canvas = require('canvas'),
Image = Canvas.Image,
leonardo = require('../leonardo.js'),
fs = require('fs');
fs.readFile("~/Pictures/marilyn.jpg", function (err, imgbuff) {
var img = new Image();
img.src = imgbuff;
img.onload = function() {
var filtered = leonardo.applyFilter(img, "vivid");
var out = fs.createWriteStream("marilyn-vivid.jpg");
filtered.jpegStream().pipe(out);
};
});
None