• Stars
    star
    3,551
  • Rank 12,494 (Top 0.3 %)
  • Language
    HTML
  • License
    BSD 3-Clause "New...
  • Created about 14 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Javascript HTML5 (Ca)nvas (Man)ipulation

About the Project

This project is no longer actively maintained. Thanks everyone for the support and interest over the years!

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. All features that are not a part of the core CamanJS library are in a separate plugins repository.

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.

CamanJS is written in Coffeescript as of version 3.0. It works both in-browser and in NodeJS.

CamanJS is a project that I work on in purely my own spare time. If you would like to pitch in a beer or donate to say thanks, my Bitcoin address is: 1EVNQ7FiWDaqpfYXRLCtgMe5RBcz3kEuAG

Usage

Include one of the versions in the dist/ folder, then you can run:

Caman("#image-id", function () {
  this.brightness(10);
  this.contrast(20);
  this.render(function () {
    alert("Done!");
  });
});

Caman also supports modifying images via the data-caman HTML attribute. Simply separate each instruction with a space. Images with the data-caman attribute will automatically be modified at page load.

<img data-caman="saturation(-10) brightness(20) vignette('10%')" src="path/to/image.jpg">

HiDPI Support

Version 4 introduces better support for HiDPI (Retina) displays. It allows you to specify a higher resolution replacement using HTML data attributes. Keep in mind, however, that higher resolution images take longer to render.

HTML data attributes

  • data-caman-hidpi: URL to the high resolution replacement image
  • data-caman-hidpi-disabled: HiDPI support is enabled by default, so add this attribute if you wish to force disable it

Upgrading to Version 4

There is only 1 breaking change that occured with the version 4 release. When you initialize CamanJS with a canvas and an image, the parameter order has changed. It is now:

Caman("#canvas-id", "/path/to/image.png", function() {});

This is in order to be more consistent with initialization, such that the "initialization object" is always the first parameter. Update your code accordingly.

Development

If you are a developer who is contributing directly to the project, there are some tools to help you out.

Building

To install all dependencies required for development, run npm install -d.

Because all plugins are in a separate repository, make sure you run:

git submodule init && git submodule update

To build, simply run cake build. The resulting files will be placed in the dist/ folder. Plugins will be automatically discovered and added to caman.full.js after the core library. You can also auto-compile when a file changes by using cake watch.

If you add any files to the core library, you will need to add them to the coffeeFiles array in the Cakefile. The point of this is so that order is preserved when generating the file JS file. Plugins do not need to be added to the Cakefile.

You will probably want to generate documentation if you make any changes. In addition to the normal requirements, you will also need the Python library Pygments.

To generate the documentation, run cake docs.

CDN JS Hosting

CamanJS is hosted on CDN JS if you're looking for a CDN hosting solution. It is the full and minified version of the library, which means all plugins are included. Simply load CamanJS directly from this URL for usage on your site.

NodeJS Compatibility

CamanJS is fully compatible with NodeJS. The easiest way to install it is:

npm install caman

Saving from NodeJS

To save your modified image in NodeJS, simply call the save() function after rendering is finished by passing a callback function to render(). Trying to save before rendering is finished will cause issues.

Caman = require('caman').Caman;

Caman("./path/to/file.jpg", function () {
  this.brightness(40);
  this.render(function () {
    this.save("./output.png");
  });
});

Testing

Tests for CamanJS run both in NodeJS and the browser.

NodeJS

The NodeJS tests use mocha as the test runner. The simplest way to run the test suite is by running npm test.

Browser

The browser tests are run by Karma. It will start up Chrome, Firefox, and Safari (if running OSX) in the background. You can minimize each of these browsers if desired. It will automatically run tests after CamanJS is recompiled by the Cakefile as well.

You can run Karma by running karma start, or you can do a single run with the NodeJS tests by running npm test.

More Repositories

1

psd.js

A Photoshop PSD file parser for NodeJS and browsers
CoffeeScript
2,720
star
2

CoffeeDrop

CoffeeDrop is an open-source, roll your own, Dropbox-like clone written in CoffeeScript. Currently not working and under heavy development.
CoffeeScript
509
star
3

ajax-chosen

A complement to the jQuery library Chosen that adds ajax autocomplete
CoffeeScript
409
star
4

flickr-store

Store arbitrary data on Flickr
Ruby
275
star
5

git-lfs-s3

A Git LFS server that uses S3 as the storage backend.
Ruby
216
star
6

CamanJS-Plugins

Plugins for CamanJS, a Javascript image manipulation library
CoffeeScript
195
star
7

RubyDrop

A roll your own Dropbox-like clone written in Ruby.
Ruby
127
star
8

nanocrawler

Web-based front end for viewing information about your Nano node and exploring the Nano network
JavaScript
83
star
9

CamanJS-Site

CamanJS Homepage
JavaScript
66
star
10

node-activerecord

A ORM written in Coffeescript that supports multiple database systems (SQL/NoSQL) and ID generation middleware.
CoffeeScript
58
star
11

JSONP-Fu

A Javascript library that provides access to multiple JSONP API's through a unified, extensible, and easy to use interface.
JavaScript
27
star
12

node-iracing

iRacing SDK bindings for NodeJS
C++
22
star
13

png-encode

Encode/decode arbitrary files using the PNG file format
Ruby
14
star
14

coffeescript-module

A base class for your Coffeescript projects
CoffeeScript
14
star
15

bindata.js

A structured and understandable way to read/write binary data in Javascript. Inspired by Ruby BinData.
CoffeeScript
10
star
16

Osimo-BBCode-Editor

An easy to use jQuery plugin BBCode editor
JavaScript
9
star
17

CamanJ

Java port of the CamanJS image manipulation library
Java
8
star
18

CamanDrop

Easy and automatic image filters using CamanJS, watch folders, and NodeJS.
JavaScript
7
star
19

NodeMonitor

A distributed server monitoring system written in Javascript for Node.JS that uses WebSockets to show server info in near real-time from the browser.
JavaScript
7
star
20

iracing-websocket-server

A WebSocket based server that streams data from iRacing to the browser.
JavaScript
7
star
21

Asyrch

Asynchronous web searching using web workers and ajax
JavaScript
6
star
22

qr-logo

A simple library for customizing a QR code with a logo.
JavaScript
5
star
23

campfire-notifier

A self-hosted Campfire push notification service
Ruby
4
star
24

wiki-philosophy

How many clicks does it take to get from any word to Philosophy on Wikipedia?
JavaScript
4
star
25

nano-ipc-js

Javascript library for interacting with the Nano node IPC
JavaScript
4
star
26

nano-seeds.lol

A take on keys.lol, but for Nano based currencies
JavaScript
4
star
27

MeltingIce-File-System

An online storage service with support for multiple users, Flash file uploading, and advanced user management. Project is no longer under active development.
PHP
4
star
28

Notetakr

An online note-taking application - no longer hosted, code is for experimentation and learning. This was a very old project of mine and is no longer under development.
JavaScript
3
star
29

TransmissionRemote-Pebble

Check on the status of your Transmission torrents from your Pebble smartwatch
JavaScript
3
star
30

meltingice.github.com

Github homepage
JavaScript
3
star
31

Osimo-BBCode-Parser

The BBCode parser made for Osimo Forum System, but can be used for any project.
PHP
3
star
32

node-memcached

A Node.JS memcached interface
3
star
33

Osimo-Forum-System-v2

Osimo is a forum system written from the ground up to be easy to theme and use.
PHP
3
star
34

Caman-C

C port of the Javascript image manipulation library CamanJS
C
3
star
35

nano-grpc

A gRPC server for the Nano cryptocurrency node
JavaScript
2
star
36

jSearch

A jQuery plugin to search an HTML element for a query and highlight the matches. Also, has a iPhone bookmarklet to search the current page and auto search engine detection.
JavaScript
2
star
37

nanocrawler-phoenix

Elixir/Phoenix based version of Nanocrawler, a Nano network explorer
JavaScript
1
star
38

nano-node-statsd

StatsD data collection for Nano currency nodes
JavaScript
1
star
39

cs-terrain-generator

A fractal terrain generator made especially for Cities: Skylines.
JavaScript
1
star
40

nano-ipc-rest

A simple IPC + REST RPC server for the Nano cryptocurrency node.
JavaScript
1
star
41

poopelo

Checks to see if our neighborhood pool is closed.
JavaScript
1
star
42

Osimo-Forum-System-v1

The old version of the Osimo Forum System that has been migrated to GitHub for archival purposes mostly. Please visit the Osimo Version 2 page to see the latest development!
PHP
1
star
43

Ghetto-FBChat

Back before Facebook supported its chat feature on mobile devices, I began to create a simple website that would allow this functionality without using the Facebook API. Chances are this code doesn't even work anymore, so it's here mostly for viewing pleasure.
JavaScript
1
star
44

deviant

An elasticsearch backed exception logging service
Ruby
1
star