meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation

Home Page:http://camanjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Use Caman.Convert

Seikon opened this issue · comments

Hi!

I am trying to convert an image from rgb to hsv using Caman.Convert, but i don't find enough documentation how to use it and import the needed modules.

Can anyone show an example of how to use Caman.Convert?

Thank you.

Seems developers forgot to add Caman.Convert declaration in their code, so it should look like Caman.Convert =Convert = (function() {.....

then something like

Caman = require('caman.full.js').Caman;
Convert = Caman.Convert;

Caman.Filter.register('someFilter', function () {
    this.process('someFilter', function (rgba) {
            var hsv = Convert.rgbToHSV(rgba.r, rgba.g, rgba.b);
            var out= Convert.hsvToRGB(hsv.h, hsv.s, hsv.v);
        }
        // Return the modified RGB values
        return out;
    });
});