leonardo

0.0.2 • Public • Published

leonardo

A minimalist image filter library for javascript

Available filters

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)

Usage

In the browser

Replace an image by a filtered version:

var image = document.getElementById('my-image');
var filteredCanvas = leonardo.applyFilter(image, 'greyscale');
image.src = filteredCanvas.toDataURL();

In node

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);
  };
});

Dependencies

In the browser

None

In node

Readme

Keywords

Package Sidebar

Install

npm i leonardo

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • lovasoa