Open Source JavaScript Library for Image Processing

JavaScript API for applying different effects to images using different kinds of filters such as gaussian, grayscale, highpass, invert, laplacian, mirror,RGB, Roberts, saturation & more.

Lena.js a very simple light-weight image processing library that enables software developers to work with different types of images from inside their JavaScript applications. It is a pure JavaScript library that can work on Node as well as in-browser without any external dependencies.  The library is open source and is available under the MIT license. The library is not very good with heavy images inside the browser but is very efficient for the manipulation of small images.

Lena.js is very easy to use and can apply different effects to images. The image filters enable software apps to apply different effects on images with just one click. The library has included support for several important image filters, some important ones are gaussian, grayscale, highpass, invert, laplacian, mirror, noise, prewitt, RGB, Roberts, saturation, sepia, sharpen, and many more. The library also supports applying multiple filters to an image.  The filters are stored in the same global variable LenaJS and can be accessed through its id using the key or dot notation.

Previous Next

Getting Started with LenaJs

The recommended way to install LenaJs via NPM. Please use the following command to install it.

Install Lena.Js via NPM

 npm install lena.js --save 

Apply Filters on Image via JavaScript

The open source Lena.js library has provided a set of useful filters that can be used to apply a different kinds of effects to images inside JavaScript applications. First please provide the correct address to the image and then select the filter from the list of available filters. You can use filterImage and redrawCanvas method to easily apply a filter to the selected image. An image and a canvas will be used to apply the filter.

Applying Multiple Filters on Images

The Lena.js library enables software developers to apply multiple filters on their images inside their own JavaScript apps. Usually, a single filter is applied to an image by filterImage method. To apply multiple filters to an image you need to use the redrawCanvas method instead of filterImage. You need to pass an image already rendered with a filter as the first argument and need pass a new filter as a second argument which will be appended to the image with ease.

Processing Images via JavaScript API

The LenaJs library gives software programmers the capability to programmatically add filter in images inside JavaScript. Applying filters with LenaJs is pretty simple, the API provides two ways to add filters; filterImage() and redrawCanvas(). You need to provide an image and a canvas to the method to apply filter. In order to get the filter you can user LenaJs['filername'] method and apply it to the image using filterImage() method.