summaryrefslogtreecommitdiffstats
path: root/debian/lcms/lcms-1.19.dfsg2/python/testbed/sRGB2adobe.py
blob: 06c22f1039d47766e8a6556c34a41662ab861d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#
# Sample: Convert from sRGB to AdobeRGB,  perceptual intent
#

from lcms import *


print "Enter sRGB values"

#
# Create placeholders
#

RGB        = COLORB()

RGB[0] = input("R?")
RGB[1] = input("G?")
RGB[2] = input("B?")


#
# Open profiles
#

hsRGB   = cmsCreate_sRGBProfile()
hAdobe  = cmsOpenProfileFromFile("AdobeRGB1998.icc", "r")

#
# The transform
#

xform = cmsCreateTransform(hsRGB, TYPE_RGB_8, hAdobe, TYPE_RGB_8, INTENT_PERCEPTUAL, cmsFLAGS_NOTPRECALC)

cmsDoTransform(xform, RGB, RGB, 1)

#
#  Print results
#

print "AdobeRGB = ", RGB[0], RGB[1], RGB[2]


#
# Free all stuff
#

cmsDeleteTransform(xform)
cmsCloseProfile(hAdobe)
cmsCloseProfile(hsRGB)