CIE Colorspace Conversions

Robert Kern robert.kern at gmail.com
Mon Aug 20 15:35:27 EDT 2007


Greg Taylor wrote:
> Greetings,
> 
> I'm not sure if this is the right place to probe for interest, but I 
> figured I'd give it a shot.
> 
> Recently, a project I undertook at work required us to convert between 
> the various CIE color spaces (XYZ, Lab, LCH, Luv, etc.). I looked long 
> and hard but didn't find any Python library that did this, I was able to 
> find JavaScript and C-based implementations, but that's about it. For a 
> good example of the kinds of conversions I am referring to, see: 
> http://brucelindbloom.com/ColorCalculator.html
> 
> This is likely only to interest those in the Graphic Communications 
> industry (notably printers and anyone else having to deal with color 
> science), but I'm curious to see if anyone out there in the Python 
> community would have any use for a color conversion library. If I've 
> missed an existing implementation, feel free to point it my way as well.

I have some here (apologies for the long URL):

http://www.enthought.com/~rkern/cgi-bin/hgwebdir.cgi/colormap_explorer/file/095eaf64fd9f/colormap_explorer/conversion.py

I haven't attached a license text to it, yet, but I'm making it available under
a BSD license. Ping me if you need the real text attached to it. It requires
numpy and was adapted from an earlier version in scipy (which has a few more
colorspaces I wasn't interested in).

http://svn.scipy.org/svn/scipy/trunk/Lib/sandbox/image/color.py

I've also wrapped the LCMS library for that application if that interests you.
It doesn't do much more than what I needed, though. I wrapped it myself instead
of using the standard SWIG bindings for it so I could pass in numpy arrays.

http://www.enthought.com/~rkern/cgi-bin/hgwebdir.cgi/lcms

Let me know if there is anything I can do to make this code more useful to you.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list