Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Pure Javascript HTML5 (Ca)nvas (Man)ipulation

This branch is even with meltingice:node

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
build
dist
src
.gitignore
.gitmodules
.npmignore
LICENSE
Makefile.js
README.md
package.json

README.md

About the Project

The main focus of CamanJS is manipulating images using the HTML5 canvas and Javascript. It's a combination of a simple-to-use interface with advanced and efficient image/canvas editing techniques. It is also completely library independent and can be safely used next to jQuery, YUI, Scriptaculous, MooTools, etc.

CamanJS is very easy to extend with new filters and plugins, and it comes with a wide array of image editing functionality, which is only growing as the community makes more plugins.

For more information, I highly recommend taking a look at the official website where there is more comprehensive documentation and interactive demos. You can also read the wiki for some basic information about the project and how to use it.

Node Dependencies

In order to run CamanJS in Node, we need to simulate the HTML canvas. Because of that, there are a few dependencies:

  • cairo >= 1.10.0
    • Beware: the version in Homebrew is not up to date.
  • libjpeg
  • node-canvas

How to Use

Install

CamanJS is now a part of npm. Simply run:

npm install caman

It will install the node-canvas dependency if you don't have it installed already.

Usage

Using CamanJS is simple. It goes something like this:

var Caman = require('caman').Caman;

Caman('path/to/image.jpg', function () {
    this.brightness(10);
    this.contrast(-5);
    this.saturation(-50);
    // and so on...
    
    this.render(function () {
        /*
         * Currently only supports writing to PNG files.
         * 2nd parameter forces CamanJS to overwrite the output
         * file if it already exists.
         */
        this.save("path/to/output.png", true);
    });
});

Project Contributors

Something went wrong with that request. Please try again.