Thread: [Lcms-user] Need help recovering the chromaticities that a profile was made with
An ICC-based CMM for color management
Brought to you by:
mm2
From: Adrian Knagg-B. <aje...@gm...> - 2024-01-29 21:34:10
|
Hi, I have extracted the chromaticity xy coordinates from a cmsHPROFILE as follows: cmsCIEXYZ *red; cmsCIEXYZ *green; cmsCIEXYZ *blue; red = cmsReadTag (profile, cmsSigRedColorantTag); green = cmsReadTag (profile, cmsSigGreenColorantTag); blue = cmsReadTag (profile, cmsSigBlueColorantTag); cmsXYZ2xyY(&redxyY, &red); cmsXYZ2xyY(&greenxyY, &green); cmsXYZ2xyY(&bluexyY, &blue); However, if the profile I do this to is a sRGB profile made with chromaticities from the cmsCIExyYTRIPLE {{0.639998686, 0.330010138, 1.0}, {0.300003784, 0.600003357, 1.0}, {0.150002046, 0.059997204, 1.0}}, and the standard sRGB whitepoint cmsCIExyY d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0}; I don't get back the same coordinates. Instead I get: redxyY x: 0.648438, y: 0.330868, Y: 0.222488 greenxyY x: 0.321176, y: 0.597877, Y: 0.716904 bluexyY x: 0.155899, y: 0.066051, Y: 0.060608 What's going on here: is there something I'm not accounting for? And is there a more correct way to read the original chromaticities back out of a profile? Thanks, Adrian. |
From: <mar...@li...> - 2024-01-29 22:38:01
|
Hello, > is there something I'm not accounting for? And is there a more correct way to read the original chromaticities back out of a profile? You are assuming the internals of ICC profiles works in a way they don’t. The cmsSigXXXColorantTag tags does NOT contain direct information on the primaries, numbers are “cooked” and it is certainly possible for those tags to be missing on some profiles. You should avoid reading tags directly as much as possible. Instead, use an absolute colorimetric transform with no observer adaptation to get the primaries. This would work no matter which profile type are you using. Here an example by using the transicc tool, you can do the same creating a transform with absolute colorimetric intent making sure to set the observer adaptation state to 0 first. I am trying to recover sRGB red primary: marti@I7:~$ transicc -t3 -d0 -i*sRGB -o*XYZ LittleCMS ColorSpace conversion calculator - 5.1 [LittleCMS 2.16] Copyright (c) 1998-2023 Marti Maria Saguer. See COPYING file for details. Enter values, 'q' to quit R? 255 G? 0 B? 0 X=41.2391 Y=21.2639 Z=1.9331 You convert this XYZ of (41.2391, 21.2639, 1.9331) to xyY, for example using this link: http://www.brucelindbloom.com/ColorCalculator.html xyY = (0.6400, 0.3300, 21.2639) Which corresponds to the Rec709 chromaticity of red. Hope that helps Marti Maria The LittleCMS Project https://www.littlecms.com From: Adrian Knagg-Baugh <aje...@gm...> Sent: Monday, January 29, 2024 10:34 PM To: lcm...@li... Subject: [Lcms-user] Need help recovering the chromaticities that a profile was made with Hi, I have extracted the chromaticity xy coordinates from a cmsHPROFILE as follows: cmsCIEXYZ *red; cmsCIEXYZ *green; cmsCIEXYZ *blue; red = cmsReadTag (profile, cmsSigRedColorantTag); green = cmsReadTag (profile, cmsSigGreenColorantTag); blue = cmsReadTag (profile, cmsSigBlueColorantTag); cmsXYZ2xyY(&redxyY, &red); cmsXYZ2xyY(&greenxyY, &green); cmsXYZ2xyY(&bluexyY, &blue); However, if the profile I do this to is a sRGB profile made with chromaticities from the cmsCIExyYTRIPLE {{0.639998686, 0.330010138, 1.0}, {0.300003784, 0.600003357, 1.0}, {0.150002046, 0.059997204, 1.0}}, and the standard sRGB whitepoint cmsCIExyY d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0}; I don't get back the same coordinates. Instead I get: redxyY x: 0.648438, y: 0.330868, Y: 0.222488 greenxyY x: 0.321176, y: 0.597877, Y: 0.716904 bluexyY x: 0.155899, y: 0.066051, Y: 0.060608 What's going on here: is there something I'm not accounting for? And is there a more correct way to read the original chromaticities back out of a profile? Thanks, Adrian. |
From: Adrian Knagg-B. <aje...@gm...> - 2024-01-29 22:07:39
|
Thank you for the explanation. Yes, that's great, I will create a transform from profile to XYZ, use it to transform each RGB primary using absolute colorimetric, and then convert to xyY straightforwardly. Thanks again, Adrian. On Mon, 29 Jan 2024, 22:02 , <mar...@li...> wrote: > Hello, > > > > > is there something I'm not accounting for? And is there a more correct > way to read the original chromaticities back out of a profile? > > > > You are assuming the internals of ICC profiles works in a way they don’t. > The cmsSigXXXColorantTag tags does NOT contain direct information on the > primaries, numbers are “cooked” and it is certainly possible for those tags > to be missing on some profiles. > > > > You should avoid reading tags directly as much as possible. Instead, use > an absolute colorimetric transform with no observer adaptation to get the > primaries. This would work no matter which profile type are you using. > > > > Here an example by using the transicc tool, you can do the same creating a > transform with absolute colorimetric intent making sure to set the observer > adaptation state to 0 first. I am trying to recover sRGB red primary: > > > > marti@I7:~$ transicc -t3 -d0 -i*sRGB -o*XYZ > > LittleCMS ColorSpace conversion calculator - 5.1 [LittleCMS 2.16] > > Copyright (c) 1998-2023 Marti Maria Saguer. See COPYING file for details. > > > > Enter values, 'q' to quit > > R? 255 > > G? 0 > > B? 0 > > > > X=41.2391 Y=21.2639 Z=1.9331 > > > > You convert this XYZ of (41.2391, 21.2639, 1.9331) to xyY, for example > using this link: http://www.brucelindbloom.com/ColorCalculator.html > > > > xyY = (0.6400, 0.3300, 21.2639) Which corresponds to the Rec709 > chromaticity of red. > > > > Hope that helps > > > > Marti Maria > > The LittleCMS Project > > https://www.littlecms.com > > > > > > > > > > *From:* Adrian Knagg-Baugh <aje...@gm...> > *Sent:* Monday, January 29, 2024 10:34 PM > *To:* lcm...@li... > *Subject:* [Lcms-user] Need help recovering the chromaticities that a > profile was made with > > > > Hi, > > > > I have extracted the chromaticity xy coordinates from a cmsHPROFILE as > follows: > > > cmsCIEXYZ *red; > cmsCIEXYZ *green; > cmsCIEXYZ *blue; > red = cmsReadTag (profile, cmsSigRedColorantTag); > green = cmsReadTag (profile, cmsSigGreenColorantTag); > blue = cmsReadTag (profile, cmsSigBlueColorantTag); > > cmsXYZ2xyY(&redxyY, &red); > cmsXYZ2xyY(&greenxyY, &green); > > cmsXYZ2xyY(&bluexyY, &blue); > > > > However, if the profile I do this to is a sRGB profile made with > chromaticities from the cmsCIExyYTRIPLE {{0.639998686, 0.330010138, 1.0}, > {0.300003784, 0.600003357, 1.0}, {0.150002046, 0.059997204, 1.0}}, and the > standard sRGB whitepoint cmsCIExyY d65_srgb_adobe_specs = {0.3127, 0.3290, > 1.0}; I don't get back the same coordinates. Instead I get: > > > > redxyY x: 0.648438, y: 0.330868, Y: 0.222488 > greenxyY x: 0.321176, y: 0.597877, Y: 0.716904 > bluexyY x: 0.155899, y: 0.066051, Y: 0.060608 > > > > What's going on here: is there something I'm not accounting for? And is > there a more correct way to read the original chromaticities back out of a > profile? > > > > Thanks, > > > > Adrian. > > > |
From: Tom L. <to...@ke...> - 2024-01-30 00:09:07
|
<div dir='auto'><div dir="auto">On 29 Jan 2024 21:33, Adrian Knagg-Baugh <aje...@gm...> wrote:<br></div><div><div class="elided-text"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,<br></div><div><br></div><div>I have extracted the chromaticity xy coordinates from a cmsHPROFILE as follows:</div><div><br> cmsCIEXYZ *red;<br> cmsCIEXYZ *green;<br> cmsCIEXYZ *blue;<br> red = cmsReadTag (profile, cmsSigRedColorantTag);<br> green = cmsReadTag (profile, cmsSigGreenColorantTag);<br> blue = cmsReadTag (profile, cmsSigBlueColorantTag);<br></div><div></div> cmsXYZ2xyY(&redxyY, &red);<br> cmsXYZ2xyY(&greenxyY, &green);<br><div> cmsXYZ2xyY(&bluexyY, &blue);</div><div><br></div><div>However, if the profile I do this to is a sRGB profile made with chromaticities from the cmsCIExyYTRIPLE {<!-- -->{0.639998686, 0.330010138, 1.0}, {0.300003784, 0.600003357, 1.0}, {0.150002046, 0.059997204, 1.0}}, and the standard sRGB whitepoint cmsCIExyY d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0}; I don't get back the same coordinates. Instead I get:<br></div><div><br></div><div><span style="font-family:monospace"><span style="color:rgb( 0 , 0 , 0 );background-color:rgb( 255 , 255 , 255 )">redxyY x: 0.648438, y: 0.330868, Y: 0.222488 </span><br>greenxyY x: 0.321176, y: 0.597877, Y: 0.716904 <br>bluexyY x: 0.155899, y: 0.066051, Y: 0.060608 <br></span></div><div><span style="font-family:'arial' , sans-serif"><br></span></div><div><span style="font-family:'arial' , sans-serif">What's going on here: is there something I'm not accounting for? And is there a more correct way to read the original chromaticities back out of a profile?<br></span></div><div><span style="font-family:'arial' , sans-serif"><br></span></div><div><span style="font-family:'arial' , sans-serif">Thanks,</span></div><div><span style="font-family:'arial' , sans-serif"><br></span></div><div><span style="font-family:'arial' , sans-serif">Adrian.<br></span></div><br></div> </blockquote></div><br></div><div dir="auto">Adrian,</div><div dir="auto"><br></div><div dir="auto">red, green and blue are already pointers, so you shouldn't be taking their address.<div dir="auto"><br></div><div dir="auto">i.e. remove the &s</div><div dir="auto"><br></div><div dir="auto">Surprised your compiler didn't warn about this?</div><div dir="auto"><br></div><div dir="auto">Cheers</div></div></div> |