meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.55k stars 404 forks source link

More color space conversions #2

Closed cezarsa closed 13 years ago

cezarsa commented 13 years ago

Hi, I've added helper functions for color space conversions from RGB to the XYZ color space and from there to the CIE LAB color space (and the appropriate backward conversions). There are a few hard coded assumptions (e.g. the RGB value being in the sRGB color space and always using D65 as the white point for the Lab conversions) but I think that's fine for now. I've also created some unit tests for these new conversions.

My next goal is to create a color replacement filter based on the distance between the colors in the Lab space.

Please feel free to suggest any improvement to this code.

meltingice commented 13 years ago

Looks awesome, good work! Definitely looking forward to the color replacement filter.