[Image-SIG] Littlecms PIL module

Frédéric Mantegazza frederic.mantegazza at gbiloba.org
Sat Feb 16 15:06:11 CET 2008


I was looking for a littlcms python binding to make conversions between 
color spaces. This python binding already exists in littlecms, but it is 
not possible to convert entire images; as Marti explained, the goal is 
only to make numerical computations (one pixel at a time).

As I was thinking to use PIL, Kent (from littlecms list) pointed me to 
an old (2002) discussion on the image-sig list, where Kevin Cazabon said 
he wrote a PIL module based on lcms. Unfortunally, this module does not 
seems to be maintained, and Kevin didn't answer (yet) to my e-mail.

So, I looked at the code, which is simple, well written and well
documented, and decided to modify it for my own use. For example, I wrote 
a (very simple) setup.py file to be able to compile and install the C 
module under linux; I also removed some functions, and added epydoc 
docstrings to generate nice html pages.

This module seems to work fine, so it's maybe time to share it. As I didn't 
yet received an answer from Kevin, I won't put the code on a web site for 
now; just contact me if you want to try it.

I said I adapted the code for my own use: I just need to make color space 
conversions, and maybe extract/assign profiles to images (this last part 
is not yet written; I have to look deeper in littlecms). Marti's python 
binding can do much more things (which I don't all understand, as my 
knowledge of color management is limited), so the goal is only to write 
things which does not exists. But I'm open to ideas and suggestions.

Kent also pointed me to Phatch, a nice Photo Batch converter. So, my next 
goal is to make a Phatch action based on pyCMS, to convert images between 
color spaces (I'm looking for tutorial how to write actions, but it seems 
I have to look at existing actions code).

Sorry for cross-posting, but as a first message, I though it was a good 
idea to warn all concerned people.


P:  I'll may rewrite this module in a more pythonic way, ie using objects 
methods rather than functions.



More information about the Image-SIG mailing list