Hi Tobias - I did a bit of work with Marti a while back, and I ended up releasing PyCMS - I wrapper module around the Little CMS ICC library that also handles all the file passing complexities and such. Marti ended providing his own handles as well, but they're not nearly as easy to use.
You can use PyCMS directly in your program if you like, or simply refer to my code to see how I'm using LittleCMS. You can find PyCMS at: http://www.cazabon.com/pyCMS Kevin Cazabon ----- Original Message ----- From: "Tobias Hilbricht" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, December 14, 2005 8:35 PM Subject: [Image-SIG] How to pass an image from python as C/C++ pointer > Dear readers of this list, > > I am writing a softproof plugin for the open source vector drawing python > application Skencil by Bernhard Herzog, which runs on GNU/Linux and other > Unixes. > > This softproof plugin uses the little color management suite (lcms or > littlecms) by Marti Maria to do profile based softproofing and will show the > softproof as an bitmap representation of the vector drawing. > > lcms is written in C but provides python handles, and I could perform all > python tests of lcms. > > However, I run into a problem passing image files to lcms using python. If I > do a test with the following file softtest.py I get the error message: > > File "/home/tobias/Skencil-CMYK/testbed/softtest.py", line 15, in -toplevel- > cmsDoTransform(hTransform, im, imagesave, 500990) > TypeError: argument number 2: a 'C/C++ pointer' is expected, > 'instance(<PpmImagePlugin.PpmImageFile instance at 0x40a7ba4c>)' is received > > -------------------------------------------------------------------------- > # softtest.py -- test softproofing with lcms > > from lcms import * > import Image, ImageTk > > im = Image.open('farbtest.ppm') > imagesave = im.save('farbtest-proof.ppm', 'ppm') > > hInput = cmsOpenProfileFromFile("AdobeRGB1998.icc", "r") > hOutput = cmsOpenProfileFromFile("l568d65.icm", "r") > hProof = cmsOpenProfileFromFile("EuroscaleCoated.icc", "r") > > hTransform = cmsCreateProofingTransform(hInput, TYPE_BGR_8, hOutput, > TYPE_BGR_8, hProof, INTENT_PERCEPTUAL, INTENT_PERCEPTUAL, 0) > > cmsDoTransform(hTransform, im, imagesave, 500990) > > cmsDeleteTransform(hTransform) > cmsCloseProfile(hInput) > cmsCloseProfile(hOutput) > cmsCloseProfile(hProof) > ------------------------------------------------------------------------ > > How do I pass an image file as C/C++ pointer from python to lcms? > > Thanks for any helpful hints in advance > > Yours sincerely > > Tobias Hilbricht > > -- > Dr. Tobias Hilbricht > Linopus Satz und Grafik > www.linopus.de > _______________________________________________ > Image-SIG maillist - [email protected] > http://mail.python.org/mailman/listinfo/image-sig > > > _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig
