lcms-user Mailing List for Little cms color engine (Page 11)
An ICC-based CMM for color management
Brought to you by:
mm2
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(15) |
Jun
(24) |
Jul
(9) |
Aug
(14) |
Sep
|
Oct
(12) |
Nov
(17) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(34) |
Feb
(7) |
Mar
(7) |
Apr
(16) |
May
(4) |
Jun
(14) |
Jul
(34) |
Aug
(54) |
Sep
(11) |
Oct
(25) |
Nov
(1) |
Dec
(6) |
2003 |
Jan
(27) |
Feb
(54) |
Mar
(23) |
Apr
(68) |
May
(82) |
Jun
(36) |
Jul
(45) |
Aug
(45) |
Sep
(49) |
Oct
(30) |
Nov
(65) |
Dec
(23) |
2004 |
Jan
(52) |
Feb
(52) |
Mar
(35) |
Apr
(38) |
May
(93) |
Jun
(22) |
Jul
(51) |
Aug
(50) |
Sep
(73) |
Oct
(28) |
Nov
(30) |
Dec
(51) |
2005 |
Jan
(22) |
Feb
(79) |
Mar
(38) |
Apr
(51) |
May
(95) |
Jun
(60) |
Jul
(56) |
Aug
(49) |
Sep
(22) |
Oct
(43) |
Nov
(15) |
Dec
(40) |
2006 |
Jan
(51) |
Feb
(31) |
Mar
(37) |
Apr
(25) |
May
(9) |
Jun
(13) |
Jul
(17) |
Aug
(66) |
Sep
(7) |
Oct
(12) |
Nov
(14) |
Dec
(31) |
2007 |
Jan
(18) |
Feb
(9) |
Mar
(22) |
Apr
(18) |
May
(5) |
Jun
(25) |
Jul
(2) |
Aug
(15) |
Sep
(12) |
Oct
(40) |
Nov
(10) |
Dec
(23) |
2008 |
Jan
(21) |
Feb
(56) |
Mar
(12) |
Apr
(23) |
May
(47) |
Jun
(75) |
Jul
(24) |
Aug
(2) |
Sep
(7) |
Oct
(26) |
Nov
(20) |
Dec
(16) |
2009 |
Jan
(14) |
Feb
(1) |
Mar
(29) |
Apr
(54) |
May
(18) |
Jun
(16) |
Jul
(5) |
Aug
(3) |
Sep
(38) |
Oct
(6) |
Nov
(25) |
Dec
(28) |
2010 |
Jan
(11) |
Feb
(26) |
Mar
(2) |
Apr
(10) |
May
(45) |
Jun
(94) |
Jul
(11) |
Aug
(32) |
Sep
(18) |
Oct
(37) |
Nov
(19) |
Dec
(34) |
2011 |
Jan
(21) |
Feb
(16) |
Mar
(16) |
Apr
(29) |
May
(17) |
Jun
(18) |
Jul
(7) |
Aug
(21) |
Sep
(10) |
Oct
(7) |
Nov
(15) |
Dec
(6) |
2012 |
Jan
(13) |
Feb
(16) |
Mar
(15) |
Apr
(12) |
May
(15) |
Jun
(31) |
Jul
(22) |
Aug
(15) |
Sep
(46) |
Oct
(21) |
Nov
(15) |
Dec
(33) |
2013 |
Jan
(19) |
Feb
(17) |
Mar
(31) |
Apr
(17) |
May
(27) |
Jun
(24) |
Jul
(26) |
Aug
(11) |
Sep
(9) |
Oct
(22) |
Nov
(14) |
Dec
(16) |
2014 |
Jan
(20) |
Feb
(66) |
Mar
(29) |
Apr
(13) |
May
(9) |
Jun
|
Jul
(11) |
Aug
(21) |
Sep
(15) |
Oct
(5) |
Nov
(5) |
Dec
(10) |
2015 |
Jan
(6) |
Feb
(26) |
Mar
(26) |
Apr
|
May
(9) |
Jun
(5) |
Jul
(5) |
Aug
(11) |
Sep
(8) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
|
Mar
(9) |
Apr
(3) |
May
(16) |
Jun
(26) |
Jul
(32) |
Aug
(27) |
Sep
(9) |
Oct
|
Nov
(4) |
Dec
(10) |
2017 |
Jan
(11) |
Feb
(44) |
Mar
(6) |
Apr
(8) |
May
(1) |
Jun
(2) |
Jul
(34) |
Aug
(28) |
Sep
(3) |
Oct
(9) |
Nov
(3) |
Dec
|
2018 |
Jan
(1) |
Feb
(5) |
Mar
(6) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
2019 |
Jan
(18) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(7) |
Sep
(3) |
Oct
(10) |
Nov
(1) |
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(17) |
Jun
(23) |
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
(10) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
(8) |
Feb
|
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(13) |
Nov
(12) |
Dec
|
2023 |
Jan
|
Feb
(1) |
Mar
(9) |
Apr
|
May
(3) |
Jun
(5) |
Jul
(3) |
Aug
(8) |
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2024 |
Jan
(8) |
Feb
|
Mar
(14) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul A N. <pau...@gm...> - 2018-04-16 06:53:01
|
Hi, As in the subject line, I was wanting to obtain the 64 bit binaries for a Windows based Lazarus project please, I am not in a position to compile these myself at the moment and wanted to know if any one had put these on the web any where for download please? - I can not find any where after extensive Google searches :-) Any help appreciated please. TIA Paul |
From: John J. <j.j...@nt...> - 2018-03-27 14:42:23
|
Sorry, a third thing. You need to marshal the input & output colour data using a special array format, because the bindings don't do that automatically. You need to do something like this: RGB = [255,255,255] rgb_in = uint8Array(in_comps * n_pixels) Lab_out = doubleArray(out_comps * n_pixels) for i in range(in_comps * n_pixels): rgb_in[i] = RGB[i] cmsDoTransform(....) Lab_tuple = tuple(Lab_out[i] for i in range(out_comps * n_pixels)) The test_05_transform_rgb_Lab test gives an example of what you should be doing. Sorry, that's the way it is until effort is put into doing automatic marshalling to/from Python lists. John On 27/03/2018 15:22, John Jefferies wrote: > > Hi, > The first thing, cmsCIExyY() shouldn't be used as the white point of > the Lab profile. It is initialised to (0, 0, 0) which obviously isn't > right. You probably want cmsD50_xyY() instead. > > The second thing. The format of the RGB data is TYPE_RGB_DBL. That > doesn't match the [255, 255, 255] that's used. Use TYPE_RGB_8 instead. > > I haven't tested the result of applying these, but it should get you > further. > > John > > On 27/03/2018 10:12, Gonzalez Cano, Jordi wrote: >> >> I would like to use the LCMS with python, but when I want to call the >> function cmsDoTransform the following error appears: /TypeError: in >> method 'cmsDoTransform', argument 2 of type 'void const *'/ >> >> What I am sending to the cmsDoTransform si the following: >> >> /array = [255,255,255]/ >> >> /labColor = lcmsF.transformToLab(array,profileInURL,"RGB","perceptual")/ >> >> // >> >> /--------------- / >> >> // >> >> /def transformToLab(inputColor, profileInURL, formatIn, intent, BPC = >> True):/ >> >> / LabColor = []/ >> >> // >> >> / labProfile = lcms.cmsCreateLab4Profile(lcms.cmsCIExyY())/ >> >> / inputProfile = lcms.cmsOpenProfileFromFile(profileInURL, "r")/ >> >> // >> >> / if(formatIn == "RGB"):/ >> >> / inType = lcms.TYPE_RGB_DBL/ >> >> / elif(formatIn == "CMYK"):/ >> >> / inType = lcms.TYPE_CMYK_DBL/ >> >> // >> >> / if(intent == "perceptual"):/ >> >> / m_intent = lcms.INTENT_PERCEPTUAL/ >> >> // >> >> / if(BPC):/ >> >> / m_BPC = lcms.cmsFLAGS_BLACKPOINTCOMPENSATION/ >> >> / else:/ >> >> / m_BPC = 0/ >> >> / transform = lcms.cmsCreateTransform(inputProfile, inType, >> labProfile, lcms.TYPE_Lab_DBL, m_intent, m_BPC)/ >> >> // >> >> */ lcms.cmsDoTransform(transform,inputColor, LabColor, DIM_OUT)/* >> >> / return LabColor/ >> >> // >> >> How I am supposed to do it? >> >> Thanks, >> >> Jordi G.C. >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >> >> >> _______________________________________________ >> Lcms-user mailing list >> Lcm...@li... >> https://lists.sourceforge.net/lists/listinfo/lcms-user > |
From: John J. <j.j...@nt...> - 2018-03-27 14:35:31
|
On 27/03/2018 15:31, Aaron Boxer wrote: > > On Tue, Mar 27, 2018 at 10:22 AM, John Jefferies via Lcms-user > <lcm...@li... > <mailto:lcm...@li...>> wrote: > > > Hi, > The first thing, cmsCIExyY() shouldn't be used as the white point > of the Lab profile. It is initialised to (0, 0, 0) which > obviously isn't right. You probably want cmsD50_xyY() instead. > > The second thing. The format of the RGB data is TYPE_RGB_DBL. That > doesn't match the [255, 255, 255] that's used. Use TYPE_RGB_8 instead. > > > > Doesn't [255,255,255] create an array of dimension 255x255x255 ? No, it creates a 3 element list. John |
From: Aaron B. <bo...@gm...> - 2018-03-27 14:31:18
|
On Tue, Mar 27, 2018 at 10:22 AM, John Jefferies via Lcms-user < lcm...@li...> wrote: > > Hi, > The first thing, cmsCIExyY() shouldn't be used as the white point of the > Lab profile. It is initialised to (0, 0, 0) which obviously isn't right. > You probably want cmsD50_xyY() instead. > > The second thing. The format of the RGB data is TYPE_RGB_DBL. That doesn't > match the [255, 255, 255] that's used. Use TYPE_RGB_8 instead. > Doesn't [255,255,255] create an array of dimension 255x255x255 ? On 27/03/2018 10:12, Gonzalez Cano, Jordi wrote: I would like to use the LCMS with python, but when I want to call the function cmsDoTransform the following error appears: *TypeError: in method 'cmsDoTransform', argument 2 of type 'void const *'* What I am sending to the cmsDoTransform si the following: *array = [255,255,255]* *labColor = lcmsF.transformToLab(array,profileInURL,"RGB","perceptual")* *--------------- * *def transformToLab(inputColor, profileInURL, formatIn, intent, BPC = True):* * LabColor = []* * labProfile = lcms.cmsCreateLab4Profile(lcms.cmsCIExyY())* * inputProfile = lcms.cmsOpenProfileFromFile(profileInURL, "r")* * if(formatIn == "RGB"):* * inType = lcms.TYPE_RGB_DBL* * elif(formatIn == "CMYK"):* * inType = lcms.TYPE_CMYK_DBL* * if(intent == "perceptual"):* * m_intent = lcms.INTENT_PERCEPTUAL* * if(BPC):* * m_BPC = lcms.cmsFLAGS_BLACKPOINTCOMPENSATION* * else:* * m_BPC = 0* * transform = lcms.cmsCreateTransform(inputProfile, inType, labProfile, lcms.TYPE_Lab_DBL, m_intent, m_BPC)* * lcms.cmsDoTransform(transform,inputColor, LabColor, DIM_OUT)* * return LabColor* How I am supposed to do it? Thanks, Jordi G.C. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Lcms-user mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/lcms-user > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user > > |
From: John J. <j.j...@nt...> - 2018-03-27 14:23:05
|
Hi, The first thing, cmsCIExyY() shouldn't be used as the white point of the Lab profile. It is initialised to (0, 0, 0) which obviously isn't right. You probably want cmsD50_xyY() instead. The second thing. The format of the RGB data is TYPE_RGB_DBL. That doesn't match the [255, 255, 255] that's used. Use TYPE_RGB_8 instead. I haven't tested the result of applying these, but it should get you further. John On 27/03/2018 10:12, Gonzalez Cano, Jordi wrote: > > I would like to use the LCMS with python, but when I want to call the > function cmsDoTransform the following error appears: /TypeError: in > method 'cmsDoTransform', argument 2 of type 'void const *'/ > > What I am sending to the cmsDoTransform si the following: > > /array = [255,255,255]/ > > /labColor = lcmsF.transformToLab(array,profileInURL,"RGB","perceptual")/ > > // > > /--------------- / > > // > > /def transformToLab(inputColor, profileInURL, formatIn, intent, BPC = > True):/ > > / LabColor = []/ > > // > > / labProfile = lcms.cmsCreateLab4Profile(lcms.cmsCIExyY())/ > > / inputProfile = lcms.cmsOpenProfileFromFile(profileInURL, "r")/ > > // > > / if(formatIn == "RGB"):/ > > / inType = lcms.TYPE_RGB_DBL/ > > / elif(formatIn == "CMYK"):/ > > / inType = lcms.TYPE_CMYK_DBL/ > > // > > / if(intent == "perceptual"):/ > > / m_intent = lcms.INTENT_PERCEPTUAL/ > > // > > / if(BPC):/ > > / m_BPC = lcms.cmsFLAGS_BLACKPOINTCOMPENSATION/ > > / else:/ > > / m_BPC = 0/ > > / transform = lcms.cmsCreateTransform(inputProfile, inType, > labProfile, lcms.TYPE_Lab_DBL, m_intent, m_BPC)/ > > // > > */ lcms.cmsDoTransform(transform,inputColor, LabColor, DIM_OUT)/* > > / return LabColor/ > > // > > How I am supposed to do it? > > Thanks, > > Jordi G.C. > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user |
From: Noel C. <NCa...@Pr...> - 2018-03-27 13:54:35
|
Hi Jordi, I only use Little CMS with C++ myself, and this sounds like the kind of problem that requires more language-specific knowledge of Python than I have. Acknowledging that I know nothing about Python, at first glance your array data [255,255,255] does not sound like it matches your chosen data type of lcms.TYPE_RGB_DBL. Are you trying to process byte-wide data? If so, DBL implies 64 bit double precision floating point, and that doesn't seem the right choice for the format. Hope this helps point you in the right direction. -Noel From: Gonzalez Cano, Jordi [mailto:jor...@hp...] Sent: Tue, March 27, 2018 5:12 AM To: lcm...@li... Subject: [Lcms-user] LCMS python I would like to use the LCMS with python, but when I want to call the function cmsDoTransform the following error appears: TypeError: in method 'cmsDoTransform', argument 2 of type 'void const *' What I am sending to the cmsDoTransform si the following: array = [255,255,255] labColor = lcmsF.transformToLab(array,profileInURL,"RGB","perceptual") --------------- def transformToLab(inputColor, profileInURL, formatIn, intent, BPC = True): LabColor = [] labProfile = lcms.cmsCreateLab4Profile(lcms.cmsCIExyY()) inputProfile = lcms.cmsOpenProfileFromFile(profileInURL, "r") if(formatIn == "RGB"): inType = lcms.TYPE_RGB_DBL elif(formatIn == "CMYK"): inType = lcms.TYPE_CMYK_DBL if(intent == "perceptual"): m_intent = lcms.INTENT_PERCEPTUAL if(BPC): m_BPC = lcms.cmsFLAGS_BLACKPOINTCOMPENSATION else: m_BPC = 0 transform = lcms.cmsCreateTransform(inputProfile, inType, labProfile, lcms.TYPE_Lab_DBL, m_intent, m_BPC) lcms.cmsDoTransform(transform,inputColor, LabColor, DIM_OUT) return LabColor How I am supposed to do it? Thanks, Jordi G.C. |
From: Gonzalez C. J. <jor...@hp...> - 2018-03-27 09:12:35
|
I would like to use the LCMS with python, but when I want to call the function cmsDoTransform the following error appears: TypeError: in method 'cmsDoTransform', argument 2 of type 'void const *' What I am sending to the cmsDoTransform si the following: array = [255,255,255] labColor = lcmsF.transformToLab(array,profileInURL,"RGB","perceptual") --------------- def transformToLab(inputColor, profileInURL, formatIn, intent, BPC = True): LabColor = [] labProfile = lcms.cmsCreateLab4Profile(lcms.cmsCIExyY()) inputProfile = lcms.cmsOpenProfileFromFile(profileInURL, "r") if(formatIn == "RGB"): inType = lcms.TYPE_RGB_DBL elif(formatIn == "CMYK"): inType = lcms.TYPE_CMYK_DBL if(intent == "perceptual"): m_intent = lcms.INTENT_PERCEPTUAL if(BPC): m_BPC = lcms.cmsFLAGS_BLACKPOINTCOMPENSATION else: m_BPC = 0 transform = lcms.cmsCreateTransform(inputProfile, inType, labProfile, lcms.TYPE_Lab_DBL, m_intent, m_BPC) lcms.cmsDoTransform(transform,inputColor, LabColor, DIM_OUT) return LabColor How I am supposed to do it? Thanks, Jordi G.C. |
From: Aaron B. <bo...@gm...> - 2018-02-09 23:08:17
|
Hello again, I have a JPEG 2000 image in CIELab colour space, and the file header contains: 1) the colour space illuminant 2) the precision for each channel (8 - 16 bits) 3) range and offset for mapping pixels into Lab coordinates With this information, can I create a suitable profile in LCMS? (I can save it via cmsSaveProfileToMem) Any insight would be very greatly appreciated. Thanks, Aaron |
From: Aaron B. <bo...@gm...> - 2018-02-09 18:59:01
|
Alright, I now get it : these are the range and offset values for the L,a and b coordinates in Lab space; the first block sets the values for Lab space with default illuminant D50. The second block is for a non-default Lab space (Jab space, for example ?) On Fri, Feb 9, 2018 at 9:10 AM, Aaron Boxer <bo...@gm...> wrote: > Thanks, Noel, I will do that. > > Another question: there seems to be two ways of defining the CIELab > profile, a default profile > and also a custom profile determined by the 7 values stored in the JP2 > file. > > The logic is: > > int row[9]; > if(default_type == 0x44454600) { /* DEF : default */ > rl = 100; > ra = 170; > rb = 200; > ol = 0; > oa = pow(2, prec1 - 1); > ob = pow(2, prec2 - 2) + pow(2, prec2 - 3); > } else { > rl = row[2]; > ra = row[4]; > rb = row[6]; > ol = row[3]; > oa = row[5]; > ob = row[7]; > } > > For the custom profile, can I get LCMS to save this into a single buffer? > > Thanks a lot, > Aaron > > > > On Fri, Feb 9, 2018 at 8:43 AM, Noel Carboni <NCarboni@prodigitalsoftware. > com> wrote: > >> Look into the cmsSaveProfile.... functions. >> >> >> >> By the way (for Marti) there's a typo in the documentation for >> cmsSaveProfileToMem; "guareanteed" should be "guaranteed". >> >> >> >> -Noel >> >> >> >> *From:* Aaron Boxer [mailto:bo...@gm...] >> *Sent:* Fri, February 9, 2018 8:33 AM >> *To:* lcm...@li... >> *Subject:* [Lcms-user] Serializing CIELab to buffer >> >> >> >> Hello Everyone, >> >> I have a JPEG 2000 image with a stored CIELab color profile. >> >> This profile is determined by 7 32 bit values. >> >> My code currently uses LCMS to apply the profile to the image before >> decoding to TIFF. >> >> I would prefer to store this color profile in the TIFF image. >> >> I can do that if I can serialize the profile into a buffer of bytes. >> >> I am using LCMS to apply the CIELab as follows: >> >> cmsHPROFILE in = cmsCreateLab4Profile(nullptr); >> cmsHPROFILE out = cmsCreate_sRGBProfile(); >> cmsHTRANSFORM transform = >> cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, >> INTENT_PERCEPTUAL, 0); >> >> >> >> and then applying the transform to each pixel. >> >> Is there a way of serializing this profile to a memory buffer, so that I >> can store it in the TIFF file? >> >> >> >> Thanks so much, >> >> Aaron >> >> >> >> >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Lcms-user mailing list >> Lcm...@li... >> https://lists.sourceforge.net/lists/listinfo/lcms-user >> >> > |
From: Aaron B. <bo...@gm...> - 2018-02-09 14:11:02
|
Thanks, Noel, I will do that. Another question: there seems to be two ways of defining the CIELab profile, a default profile and also a custom profile determined by the 7 values stored in the JP2 file. The logic is: int row[9]; if(default_type == 0x44454600) { /* DEF : default */ rl = 100; ra = 170; rb = 200; ol = 0; oa = pow(2, prec1 - 1); ob = pow(2, prec2 - 2) + pow(2, prec2 - 3); } else { rl = row[2]; ra = row[4]; rb = row[6]; ol = row[3]; oa = row[5]; ob = row[7]; } For the custom profile, can I get LCMS to save this into a single buffer? Thanks a lot, Aaron On Fri, Feb 9, 2018 at 8:43 AM, Noel Carboni < NCa...@pr...> wrote: > Look into the cmsSaveProfile.... functions. > > > > By the way (for Marti) there's a typo in the documentation for > cmsSaveProfileToMem; "guareanteed" should be "guaranteed". > > > > -Noel > > > > *From:* Aaron Boxer [mailto:bo...@gm...] > *Sent:* Fri, February 9, 2018 8:33 AM > *To:* lcm...@li... > *Subject:* [Lcms-user] Serializing CIELab to buffer > > > > Hello Everyone, > > I have a JPEG 2000 image with a stored CIELab color profile. > > This profile is determined by 7 32 bit values. > > My code currently uses LCMS to apply the profile to the image before > decoding to TIFF. > > I would prefer to store this color profile in the TIFF image. > > I can do that if I can serialize the profile into a buffer of bytes. > > I am using LCMS to apply the CIELab as follows: > > cmsHPROFILE in = cmsCreateLab4Profile(nullptr); > cmsHPROFILE out = cmsCreate_sRGBProfile(); > cmsHTRANSFORM transform = > cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, > INTENT_PERCEPTUAL, 0); > > > > and then applying the transform to each pixel. > > Is there a way of serializing this profile to a memory buffer, so that I > can store it in the TIFF file? > > > > Thanks so much, > > Aaron > > > > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user > > |
From: Noel C. <NCa...@Pr...> - 2018-02-09 13:44:07
|
Look into the cmsSaveProfile.... functions. By the way (for Marti) there's a typo in the documentation for cmsSaveProfileToMem; "guareanteed" should be "guaranteed". -Noel From: Aaron Boxer [mailto:bo...@gm...] Sent: Fri, February 9, 2018 8:33 AM To: lcm...@li... Subject: [Lcms-user] Serializing CIELab to buffer Hello Everyone, I have a JPEG 2000 image with a stored CIELab color profile. This profile is determined by 7 32 bit values. My code currently uses LCMS to apply the profile to the image before decoding to TIFF. I would prefer to store this color profile in the TIFF image. I can do that if I can serialize the profile into a buffer of bytes. I am using LCMS to apply the CIELab as follows: cmsHPROFILE in = cmsCreateLab4Profile(nullptr); cmsHPROFILE out = cmsCreate_sRGBProfile(); cmsHTRANSFORM transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); and then applying the transform to each pixel. Is there a way of serializing this profile to a memory buffer, so that I can store it in the TIFF file? Thanks so much, Aaron |
From: Aaron B. <bo...@gm...> - 2018-02-09 13:33:32
|
Hello Everyone, I have a JPEG 2000 image with a stored CIELab color profile. This profile is determined by 7 32 bit values. My code currently uses LCMS to apply the profile to the image before decoding to TIFF. I would prefer to store this color profile in the TIFF image. I can do that if I can serialize the profile into a buffer of bytes. I am using LCMS to apply the CIELab as follows: cmsHPROFILE in = cmsCreateLab4Profile(nullptr); cmsHPROFILE out = cmsCreate_sRGBProfile(); cmsHTRANSFORM transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); and then applying the transform to each pixel. Is there a way of serializing this profile to a memory buffer, so that I can store it in the TIFF file? Thanks so much, Aaron |
From: Christopher P. <cpo...@gl...> - 2018-01-31 14:32:44
|
I have a scanner profile, which is embedded into a tiff, I extract the profile and apply the transform but the lab values have a larger delta e than expected. Converting a single pixel. hInput is the RGB input profile that was extracted from the tiff. dwInIntent = Perceptual dwLabColorspace = Lab Double dwInColorspace = Rgb double InputDouble = 0.0006, 0.6555, 0.6730 cmsHTRANSFORM hTransLab = cmsCreateTransform(hInput, dwInColorspace, hLab, dwLabColorspace, dwInIntent, 0); cmsDoTransform(hTransLab, InputDouble, l_lab, 1); Output lab is 62, -36, -13 What is expected is 60,-42,-13 (B8 on a digital sg card) If I test the same tiff in photoshop the deltaE is much closer 1 vs 2.8 some others are as far off as 6.5. Any ideas? |
From: Marti <mar...@li...> - 2017-11-25 19:23:00
|
Hi, I am glad to the announce the release 2.9 of the Little CMS open source color engine. Version 2.9 is a maintenance release. It fixes several bugs and adds more testing. XCode and Visual Studio 2017 are supported in this release. Little CMS intends to be a small-footprint color management engine, with special focus on accuracy and performance. It uses the International Color Consortium standard (ICC), which is the modern standard when regarding to color management. The ICC specification is widely used and is referred to in many International and other de-facto standards. For more information, please take a look on: Main site: <http://www.littlecms.com/> http://www.littlecms.com Downloads: <http://www.littlecms.com/download.html> http://www.littlecms.com/download.html Best regards, Marti Maria The Little CMS project <http://www.littlecms.com/> http://www.littlecms.com |
From: Edgar L. <lo...@co...> - 2017-11-08 08:41:38
|
in the kita post it was written: [...]Proofing Rendering Intent - Absolute Calorimetric.[...] In _absolute_ colormetric RI RGB Black (0,0,0) is out of gamut for any real CMYK color space. So this works like intended. PS is showing the same result if you choose _absolute_ colorimetric for proofing there. Edgar Am 07.11.2017 um 23:01 schrieb Boudewijn Rempt: > We just got this post: > > https://forum.kde.org/viewtopic.php?f=139&t=142777&p=383631#p383605 > > Basically, with that profile, lcms marks black as out of gamut, > while a well-known image editing application doesn't. Is this us > missing a flag to set when calling lcms, or that Other App doing > weird stuff it shouldn't? > -- lakeBits Inh. Edgar Loser Haydnstr. 25 78464 Konstanz Tel 0049 7531 5844154 0 Fax 0049 7531 5844154 9 https://www.colymp.com/ mailto:lo...@co... |
From: Boudewijn R. <bo...@va...> - 2017-11-07 22:17:10
|
We just got this post: https://forum.kde.org/viewtopic.php?f=139&t=142777&p=383631#p383605 Basically, with that profile, lcms marks black as out of gamut, while a well-known image editing application doesn't. Is this us missing a flag to set when calling lcms, or that Other App doing weird stuff it shouldn't? -- Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org |
From: Derek B. N. <de...@gl...> - 2017-10-23 20:01:43
|
Thanks, that makes sense. - Derek On 2017 Oct 23, Martí Maria wrote: > > Hi, > > XYZ gamut is huge, so using tetrahedral interpolation from XYZ to RGB is > likely to result in errors. I would use cmsFLAGS_NOOPTIMIZE in xyzToRGB > color transform to force all the math. > > Another option is to use float or double values. > > Regards > > Marti > > > On 10/20/2017 9:50 PM, Derek B. Noonburg wrote: >> I'm working on some color management code, using LCMS2, and I'm running >> into some behavior that I don't understand. >> >> If I convert sRGB to XYZ and then back to sRGB, I get significantly >> different RGB values at the output. >> >> If I do sRGB -> Lab -> sRGB, I get exactly the same values back. >> >> The really weird part is: if I convert XYZ to Lab and then to sRGB (sRGB >> -> XYZ -> Lab -> sRGB), I get the expected RGB values again. So the >> sRGB-to-XYZ conversion is fine, but the XYZ-to-sRGB conversion is wrong. >> Or, more likely, I'm doing something wrong... but I'm not sure what. >> >> Can someone explain what's going on here? >> >> I'm running LCMS 2.8 on Linux. Here's my test program: >> >> #include <stdio.h> >> #include <lcms2.h> >> >> int main(int argc, char *argv[]) { >> cmsHPROFILE rgbProfile = cmsCreate_sRGBProfile(); >> cmsHPROFILE labProfile = cmsCreateLab2Profile(NULL); >> cmsHPROFILE xyzProfile = cmsCreateXYZProfile(); >> cmsHTRANSFORM rgbToLab = cmsCreateTransform(rgbProfile, TYPE_RGB_8, >> labProfile, TYPE_Lab_16, >> INTENT_ABSOLUTE_COLORIMETRIC, >> 0); >> cmsHTRANSFORM labToRGB = cmsCreateTransform(labProfile, TYPE_Lab_16, >> rgbProfile, TYPE_RGB_8, >> INTENT_ABSOLUTE_COLORIMETRIC, >> 0); >> cmsHTRANSFORM rgbToXYZ = cmsCreateTransform(rgbProfile, TYPE_RGB_8, >> xyzProfile, TYPE_XYZ_16, >> INTENT_ABSOLUTE_COLORIMETRIC, >> 0); >> cmsHTRANSFORM xyzToRGB = cmsCreateTransform(xyzProfile, TYPE_XYZ_16, >> rgbProfile, TYPE_RGB_8, >> INTENT_ABSOLUTE_COLORIMETRIC, >> 0); >> >> unsigned char rgbIn[3] = {0x6a, 0x3c, 0x31}; >> >> // rgb1 matches rgbIn >> unsigned short lab1[3]; >> unsigned char rgb1[3]; >> cmsDoTransform(rgbToLab, rgbIn, lab1, 1); >> cmsDoTransform(labToRGB, lab1, rgb1, 1); >> printf("RGB %02x %02x %02x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", >> rgbIn[0], rgbIn[1], rgbIn[2], >> lab1[0], lab1[1], lab1[2], >> rgb1[0], rgb1[1], rgb1[2]); >> >> // rgb2 does not match rgbIn >> unsigned short xyz2[3]; >> unsigned char rgb2[3]; >> cmsDoTransform(rgbToXYZ, rgbIn, xyz2, 1); >> cmsDoTransform(xyzToRGB, xyz2, rgb2, 1); >> printf("RGB %02x %02x %02x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", >> rgbIn[0], rgbIn[1], rgbIn[2], >> xyz2[0], xyz2[1], xyz2[2], >> rgb2[0], rgb2[1], rgb2[2]); >> >> // rgb3 matches rgbIn >> cmsCIEXYZ xyzF; >> cmsCIELab labF; >> unsigned short lab3[3]; >> unsigned char rgb3[3]; >> cmsXYZEncoded2Float(&xyzF, xyz2); >> cmsXYZ2Lab(NULL, &labF, &xyzF); >> cmsFloat2LabEncoded(lab3, &labF); >> cmsDoTransform(labToRGB, lab3, rgb3, 1); >> printf("RGB %02x %02x %02x -> XYZ %04x %04x %04x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", >> rgbIn[0], rgbIn[1], rgbIn[2], >> xyz2[0], xyz2[1], xyz2[2], >> lab3[0], lab3[1], lab3[2], >> rgb3[0], rgb3[1], rgb3[2]); >> } >> >> - Derek >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Lcms-user mailing list >> Lcm...@li... >> https://lists.sourceforge.net/lists/listinfo/lcms-user >> > |
From: Dmitry S. <dar...@gm...> - 2017-10-23 19:15:07
|
Hi, Derek. It was quick! Yes, this tutorial seems quite straightforward to me. Thanks for reply. Regards, - Dmitry On Mon, Oct 23, 2017 at 9:03 PM, Derek B. Noonburg <de...@gl...> wrote: > Hi Dmitry, > > The PDF stream associated with an ICCBased color space is an ICC > profile. You can pass that data to cmsOpenProfileFromMem (or > cmsOpenProfileFromFile, etc.). > > Then create an RGB profile, e.g., with cmsCreate_sRGBProfile. > > Then create a transform with cmsCreateTransform. > > And finally, call cmsDoTransform to convert colors from the PDF color > space to RGB. > > The LittleCMS tutorial > (http://www.littlecms.com/LittleCMS2.8%20tutorial.pdf) has more detailed > info on this. That's probably a better place to start than the API > Reference. > > - Derek > > > On 2017 Oct 23, Dmitry Salychev wrote: > > Hi, Little CMS users and developers. > > > > I just discovered the library and tried to find anything suitable about > > converting color from one space to other in user manual. There are > > functions like: > > > > cmsSetColorSpace() > > cmsXYZ2Lab() > > cmsLab2XYZ() > > > > and similar ones. I should create/load a profile, specify color space and > > feed one of these functions with, say, values for 3 components in > ICCBased > > color space to receive a simple RGB values, shouldn't I? I'm talking > about > > ICCBased because it's defined in a PDF file as a stream of data. I can > > extract it and decode, however, I have no clue how to process 3 color > > components of this space into a simple RGB color using this data. > > > > May you point me to a specific page in the manual or describe any details > > I'm missing? > > Thanks. > > > > Little CMS user manual: http://www.littlecms.com/LittleCMS2.8%20API.pdf > (p. > > 51, p. 54) > > PDF 1.7 reference: > > https://www.adobe.com/content/dam/acom/en/devnet/acrobat/ > pdfs/pdf_reference_1-7.pdf > > (p. 252) > > > > Regards, > > > > - Dmitry > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user > |
From: Derek B. N. <de...@gl...> - 2017-10-23 19:03:59
|
Hi Dmitry, The PDF stream associated with an ICCBased color space is an ICC profile. You can pass that data to cmsOpenProfileFromMem (or cmsOpenProfileFromFile, etc.). Then create an RGB profile, e.g., with cmsCreate_sRGBProfile. Then create a transform with cmsCreateTransform. And finally, call cmsDoTransform to convert colors from the PDF color space to RGB. The LittleCMS tutorial (http://www.littlecms.com/LittleCMS2.8%20tutorial.pdf) has more detailed info on this. That's probably a better place to start than the API Reference. - Derek On 2017 Oct 23, Dmitry Salychev wrote: > Hi, Little CMS users and developers. > > I just discovered the library and tried to find anything suitable about > converting color from one space to other in user manual. There are > functions like: > > cmsSetColorSpace() > cmsXYZ2Lab() > cmsLab2XYZ() > > and similar ones. I should create/load a profile, specify color space and > feed one of these functions with, say, values for 3 components in ICCBased > color space to receive a simple RGB values, shouldn't I? I'm talking about > ICCBased because it's defined in a PDF file as a stream of data. I can > extract it and decode, however, I have no clue how to process 3 color > components of this space into a simple RGB color using this data. > > May you point me to a specific page in the manual or describe any details > I'm missing? > Thanks. > > Little CMS user manual: http://www.littlecms.com/LittleCMS2.8%20API.pdf (p. > 51, p. 54) > PDF 1.7 reference: > https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf > (p. 252) > > Regards, > > - Dmitry |
From: Dmitry S. <dar...@gm...> - 2017-10-23 18:36:55
|
Hi, Little CMS users and developers. I just discovered the library and tried to find anything suitable about converting color from one space to other in user manual. There are functions like: cmsSetColorSpace() cmsXYZ2Lab() cmsLab2XYZ() and similar ones. I should create/load a profile, specify color space and feed one of these functions with, say, values for 3 components in ICCBased color space to receive a simple RGB values, shouldn't I? I'm talking about ICCBased because it's defined in a PDF file as a stream of data. I can extract it and decode, however, I have no clue how to process 3 color components of this space into a simple RGB color using this data. May you point me to a specific page in the manual or describe any details I'm missing? Thanks. Little CMS user manual: http://www.littlecms.com/LittleCMS2.8%20API.pdf (p. 51, p. 54) PDF 1.7 reference: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf (p. 252) Regards, - Dmitry |
From: Phil R. <phi...@or...> - 2017-10-23 16:17:34
|
Hello, What is the approximate date this will be declared a release ? -phil. On 09/27/2017 12:16 AM, Martí Maria wrote: > Hi, > > I've uploaded a tarball with lcms2-2.9 release candidate: > > http://www.littlecms.com/lcms2-2.9rc1.tar.gz > > It is basically a maintenance release. > > Best regards > Marti Maria > The LittleCMS project > http://www.littlecms.com/ > > > ------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user |
From: Martí M. <mar...@li...> - 2017-10-23 11:20:14
|
Hi, XYZ gamut is huge, so using tetrahedral interpolation from XYZ to RGB is likely to result in errors. I would use cmsFLAGS_NOOPTIMIZE in xyzToRGB color transform to force all the math. Another option is to use float or double values. Regards Marti On 10/20/2017 9:50 PM, Derek B. Noonburg wrote: > I'm working on some color management code, using LCMS2, and I'm running > into some behavior that I don't understand. > > If I convert sRGB to XYZ and then back to sRGB, I get significantly > different RGB values at the output. > > If I do sRGB -> Lab -> sRGB, I get exactly the same values back. > > The really weird part is: if I convert XYZ to Lab and then to sRGB (sRGB > -> XYZ -> Lab -> sRGB), I get the expected RGB values again. So the > sRGB-to-XYZ conversion is fine, but the XYZ-to-sRGB conversion is wrong. > Or, more likely, I'm doing something wrong... but I'm not sure what. > > Can someone explain what's going on here? > > I'm running LCMS 2.8 on Linux. Here's my test program: > > #include <stdio.h> > #include <lcms2.h> > > int main(int argc, char *argv[]) { > cmsHPROFILE rgbProfile = cmsCreate_sRGBProfile(); > cmsHPROFILE labProfile = cmsCreateLab2Profile(NULL); > cmsHPROFILE xyzProfile = cmsCreateXYZProfile(); > cmsHTRANSFORM rgbToLab = cmsCreateTransform(rgbProfile, TYPE_RGB_8, > labProfile, TYPE_Lab_16, > INTENT_ABSOLUTE_COLORIMETRIC, > 0); > cmsHTRANSFORM labToRGB = cmsCreateTransform(labProfile, TYPE_Lab_16, > rgbProfile, TYPE_RGB_8, > INTENT_ABSOLUTE_COLORIMETRIC, > 0); > cmsHTRANSFORM rgbToXYZ = cmsCreateTransform(rgbProfile, TYPE_RGB_8, > xyzProfile, TYPE_XYZ_16, > INTENT_ABSOLUTE_COLORIMETRIC, > 0); > cmsHTRANSFORM xyzToRGB = cmsCreateTransform(xyzProfile, TYPE_XYZ_16, > rgbProfile, TYPE_RGB_8, > INTENT_ABSOLUTE_COLORIMETRIC, > 0); > > unsigned char rgbIn[3] = {0x6a, 0x3c, 0x31}; > > // rgb1 matches rgbIn > unsigned short lab1[3]; > unsigned char rgb1[3]; > cmsDoTransform(rgbToLab, rgbIn, lab1, 1); > cmsDoTransform(labToRGB, lab1, rgb1, 1); > printf("RGB %02x %02x %02x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", > rgbIn[0], rgbIn[1], rgbIn[2], > lab1[0], lab1[1], lab1[2], > rgb1[0], rgb1[1], rgb1[2]); > > // rgb2 does not match rgbIn > unsigned short xyz2[3]; > unsigned char rgb2[3]; > cmsDoTransform(rgbToXYZ, rgbIn, xyz2, 1); > cmsDoTransform(xyzToRGB, xyz2, rgb2, 1); > printf("RGB %02x %02x %02x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", > rgbIn[0], rgbIn[1], rgbIn[2], > xyz2[0], xyz2[1], xyz2[2], > rgb2[0], rgb2[1], rgb2[2]); > > // rgb3 matches rgbIn > cmsCIEXYZ xyzF; > cmsCIELab labF; > unsigned short lab3[3]; > unsigned char rgb3[3]; > cmsXYZEncoded2Float(&xyzF, xyz2); > cmsXYZ2Lab(NULL, &labF, &xyzF); > cmsFloat2LabEncoded(lab3, &labF); > cmsDoTransform(labToRGB, lab3, rgb3, 1); > printf("RGB %02x %02x %02x -> XYZ %04x %04x %04x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", > rgbIn[0], rgbIn[1], rgbIn[2], > xyz2[0], xyz2[1], xyz2[2], > lab3[0], lab3[1], lab3[2], > rgb3[0], rgb3[1], rgb3[2]); > } > > - Derek > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user > |
From: Derek B. N. <de...@gl...> - 2017-10-20 22:33:59
|
Hi Noel, > Out of curiosity I ran your code (with a trivial correction so that > the second printf says XYZ instead of Lab). I got this output: > > RGB 6a 3c 31 -> Lab 4f43 9466 9086 -> RGB 6a 3c 31 > RGB 6a 3c 31 -> XYZ 0adc 0884 03a3 -> RGB 66 32 24 > RGB 6a 3c 31 -> XYZ 0adc 0884 03a3 -> Lab 4f5e 945e 9088 -> RGB 6a 3c 31 That matches my output exactly. > Interesting that the two different sets of intermediate Lab numbers > led to the same RGB outputs in the first and last cases. I think the differences in Lab numbers are (expected) integer accuracy issues. I'm not really surprised that the 8-bit RGB values end up the same. (I haven't tried, but I would guess that 16-bit RGB output would also show small differences.) > Marti will have to say whether the RGB->XYZ->RGB numbers are "close > enough". Certainly I've come to know color conversions are often > not exact. I'm not expecting them to be exact. What confuses me is that converting XYZ to Lab and then to RGB "fixes" the problem. That makes me think there's something funny going on. My understanding is that XYZ and Lab are both well-defined color spaces (assuming a fixed white point), so I would expect either one to produce the same (or very close) output when converting to sRGB. That is, I would expect sRGB->XYZ->sRGB and sRGB->Lab->sRGB to produce similar output. > Bigger picture-wise, I suspect there is no underlying problem in the > library since I've been using LCMS 2.8 RC (with my performance mods) > in product testing and my results are as good as the previous > version's results. > > Did you try the various options flags? > > Also, perhaps there is not enough resolution even in the 16 bit > numbers... Have you tried the example using floating point? Ok, that's interesting: switching to TYPE_XYZ_DBL avoids the problem (even if I keep TYPE_Lab_16 as is). That may be a workaround for my application. I'll need to check and see what sort of peformance hit I take (I'm doing some manipulation in the XYZ space). Thanks for your help! I'm still curious to see if someone can explain what's going on here. Why does converting the XYZ_16 values to Lab_16 before converting to RGB "fix" the problem? - Derek |
From: Noel C. <NCa...@Pr...> - 2017-10-20 22:04:53
|
Hi Derek, Out of curiosity I ran your code (with a trivial correction so that the second printf says XYZ instead of Lab). I got this output: RGB 6a 3c 31 -> Lab 4f43 9466 9086 -> RGB 6a 3c 31 RGB 6a 3c 31 -> XYZ 0adc 0884 03a3 -> RGB 66 32 24 RGB 6a 3c 31 -> XYZ 0adc 0884 03a3 -> Lab 4f5e 945e 9088 -> RGB 6a 3c 31 Interesting that the two different sets of intermediate Lab numbers led to the same RGB outputs in the first and last cases. Marti will have to say whether the RGB->XYZ->RGB numbers are "close enough". Certainly I've come to know color conversions are often not exact. Bigger picture-wise, I suspect there is no underlying problem in the library since I've been using LCMS 2.8 RC (with my performance mods) in product testing and my results are as good as the previous version's results. Did you try the various options flags? Also, perhaps there is not enough resolution even in the 16 bit numbers... Have you tried the example using floating point? -Noel |
From: Derek B. N. <de...@gl...> - 2017-10-20 20:08:25
|
I'm working on some color management code, using LCMS2, and I'm running into some behavior that I don't understand. If I convert sRGB to XYZ and then back to sRGB, I get significantly different RGB values at the output. If I do sRGB -> Lab -> sRGB, I get exactly the same values back. The really weird part is: if I convert XYZ to Lab and then to sRGB (sRGB -> XYZ -> Lab -> sRGB), I get the expected RGB values again. So the sRGB-to-XYZ conversion is fine, but the XYZ-to-sRGB conversion is wrong. Or, more likely, I'm doing something wrong... but I'm not sure what. Can someone explain what's going on here? I'm running LCMS 2.8 on Linux. Here's my test program: #include <stdio.h> #include <lcms2.h> int main(int argc, char *argv[]) { cmsHPROFILE rgbProfile = cmsCreate_sRGBProfile(); cmsHPROFILE labProfile = cmsCreateLab2Profile(NULL); cmsHPROFILE xyzProfile = cmsCreateXYZProfile(); cmsHTRANSFORM rgbToLab = cmsCreateTransform(rgbProfile, TYPE_RGB_8, labProfile, TYPE_Lab_16, INTENT_ABSOLUTE_COLORIMETRIC, 0); cmsHTRANSFORM labToRGB = cmsCreateTransform(labProfile, TYPE_Lab_16, rgbProfile, TYPE_RGB_8, INTENT_ABSOLUTE_COLORIMETRIC, 0); cmsHTRANSFORM rgbToXYZ = cmsCreateTransform(rgbProfile, TYPE_RGB_8, xyzProfile, TYPE_XYZ_16, INTENT_ABSOLUTE_COLORIMETRIC, 0); cmsHTRANSFORM xyzToRGB = cmsCreateTransform(xyzProfile, TYPE_XYZ_16, rgbProfile, TYPE_RGB_8, INTENT_ABSOLUTE_COLORIMETRIC, 0); unsigned char rgbIn[3] = {0x6a, 0x3c, 0x31}; // rgb1 matches rgbIn unsigned short lab1[3]; unsigned char rgb1[3]; cmsDoTransform(rgbToLab, rgbIn, lab1, 1); cmsDoTransform(labToRGB, lab1, rgb1, 1); printf("RGB %02x %02x %02x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", rgbIn[0], rgbIn[1], rgbIn[2], lab1[0], lab1[1], lab1[2], rgb1[0], rgb1[1], rgb1[2]); // rgb2 does not match rgbIn unsigned short xyz2[3]; unsigned char rgb2[3]; cmsDoTransform(rgbToXYZ, rgbIn, xyz2, 1); cmsDoTransform(xyzToRGB, xyz2, rgb2, 1); printf("RGB %02x %02x %02x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", rgbIn[0], rgbIn[1], rgbIn[2], xyz2[0], xyz2[1], xyz2[2], rgb2[0], rgb2[1], rgb2[2]); // rgb3 matches rgbIn cmsCIEXYZ xyzF; cmsCIELab labF; unsigned short lab3[3]; unsigned char rgb3[3]; cmsXYZEncoded2Float(&xyzF, xyz2); cmsXYZ2Lab(NULL, &labF, &xyzF); cmsFloat2LabEncoded(lab3, &labF); cmsDoTransform(labToRGB, lab3, rgb3, 1); printf("RGB %02x %02x %02x -> XYZ %04x %04x %04x -> Lab %04x %04x %04x -> RGB %02x %02x %02x\n", rgbIn[0], rgbIn[1], rgbIn[2], xyz2[0], xyz2[1], xyz2[2], lab3[0], lab3[1], lab3[2], rgb3[0], rgb3[1], rgb3[2]); } - Derek |