Thread: [Lcms-user] Serializing CIELab to buffer
An ICC-based CMM for color management
Brought to you by:
mm2
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: 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 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: 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 >> >> > |