On Wed, 15 Oct 2008 7:31:49 pm Frédéric wrote:
> Can you show an example for a in-place transform?

Yes, of course. I have just renamed the OO module to "littlecms" as I figured 
there may be some possible clashes on Wintendo using just case as a 
difference for files. This way it may better co-exist with the "classic" LCMS 
SWIG bindings, too.

Note that naming of the parameter (destinationBuffer) in the doTransform() 
call can also be omitted, as destination buffer is the second call parameter. 
I just slipped it in for the example as it makes it clearer what happens. The 
code sample below converts 8 bit device RGB to 8 bit sRGB:

#!/usr/bin/env python
import numpy
import littlecms

# Read an input profile from the file system.
myProfile = littlecms.Profile('testdata/target.icc')

# Create an LCMS default profile for Lab.
srgbProfile = littlecms.Profile(colourSpace=littlecms.PT_RGB)

# Create a transformation object for
# device RGB (8 bit) -> Lab (double) conversion,
# rendering intent INTENT_PERCEPTUAL.
myTransform = littlecms.Transform(myProfile, srgbProfile)

rgbColours = numpy.array([[159, 189, 63],
                          [230, 162, 39]],
                         dtype=numpy.uint8)

print 'device RGB colours:\n', rgbColours

# Transform just one colour tuple
myTransform.doTransform(rgbColours, destinationBuffer=rgbColours)

print 'sRGB colours:\n', rgbColours


Guy

-- 
Guy K. Kloss
Institute of Information and Mathematical Sciences
Te Kura Pūtaiao o Mōhiohio me Pāngarau
Room 2.63, Quad Block A Building
Massey University, Auckland, Albany
Private Bag 102 904, North Shore Mail Centre
voice: +64 9 414-0800 ext. 9585   fax: +64 9 441-8181
eMail: [EMAIL PROTECTED]  http://www.massey.ac.nz/~gkloss/

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to