[Solved] How to embed an sRGB profile with g=1.0 after GC conversion

Having tech problems? Post them here and do not worry, there is always a solution for you.
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

[Solved] How to embed an sRGB profile with g=1.0 after GC conversion

Post by es »

I'm trying to check the quality of various editing operations in GC and did the following conversion to a png file with an embedded custom sRGB icc profile:
  • "Picture → Colors → RGB (sRGB) → Change to Deep Color (16 Bit per channel, 64 bit)", then
  • "Filters → Core Image Filters → Color Adjustment → sRGB Tone Curve to Linear"
(as far as I understand it, this converts to linerar sRGB with 16-bit precision)
and noticed that after the first operation the profile was removed, and the 2nd operation didn't add anything either

But more importantly, even after trying the "Edit → Replace profile without matching" and choosing the "sRGB, Gamma 1.0", then saving the file, I still get no embedded profile, and on reopen it just switches back to "sRGB" (this is defined in the "Open → Color profiles" settings)

So I have a few questions
  • Am I correct that GC removes all sRGB-type profiles by default, simply replacing them with a reference?
  • Shouldn't the "sRGB Tone Curve to Linear" maybe embed the available in GC profile "sRGB, Gamma 1.0"?
  • How to embed an g=1.0 sRGB profile manually into a file?
Thanks for any clarification
User avatar
forum_adm
Site Admin
Posts: 1818
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by forum_adm »

Conversion to 16 bit color depths keeps the color profile.

Did you maybe uncheck the storing of ICC profiles in the PNG save as options? The saving is ON as default.
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by es »

forum_adm wrote: Sun Dec 11, 2022 9:16 am Did you maybe uncheck the storing of ICC profiles in the PNG save as options? The saving is ON as default.
Nope, it's on as in the default, but note that the message says that sRGB profile is NOT saved as I suggested in my first question
png.png
png.png (559.6 KiB) Viewed 1316 times
I've also noticed that the Info dialog in the Editor shows the correct existing color profile in the Image properties, and even after I save (or save as) the file, but then on reopening the file the information is gone (so the Info dialog is not always up-to-date)
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by es »

forum_adm wrote: Sun Dec 11, 2022 9:16 am Conversion to 16 bit color depths keeps the color profile.
I've checked this with an ProPhoto RGB color profile and you're right, after the conversion and saving the PNG the profile remains. So it's most likely the issue with a blanket removal of sRGB profiles on save
User avatar
forum_adm
Site Admin
Posts: 1818
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by forum_adm »

sRGB profiles are not embedded into PNGs following to the PNG specification. Only the name: sRGB Profile is embedded. So, any app assigns the default sRGB profile upon opening.
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by es »

forum_adm wrote: Sun Dec 11, 2022 12:20 pm sRGB profiles are not embedded into PNGs following to the PNG specification. Only the name: sRGB Profile is embedded. So, any app assigns the default sRGB profile upon opening.
Would you please point to where it says in the spec that the "iCCP Embedded ICC profile" present in the original PNG file must be replaced with the implicit sRGB flag?
After cursory reading I've found only one limitation in the spec
A file should contain at most one embedded profile, whether explicit like iCCP or implicit like sRGB.
Well, the original file had only one embedded profile (iCCP), so shouldn't it be preserved on output?
spec:http://ftp-osl.osuosl.org/pub/libpng/do ... .Anc-color


Also, regardless of the above, when you do the 2nd transofmation to linear light (g=1.0), the color profile is not sRGB anymore (as far as I understand, the sRGB spec mandates g=2.2), so shouldn't GC replace the implicit sRGB flag with an embedded color profile with g=1.0 (which you already have supplied with your app "sRGB, Gamma=1.00.icc")?
User avatar
forum_adm
Site Admin
Posts: 1818
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by forum_adm »

I write for sRGB the implicit sRGB tag:
Screenshot 2022-12-11 at 15.39.jpg
Screenshot 2022-12-11 at 15.39.jpg (518.68 KiB) Viewed 1292 times
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by es »

Yes, I understand that this is what your app does, but that doesn't address my two questions:
  • Why does it replace the embedded sRGB profile, where does the spec demand it?
  • Why does it not replace the tag with a proper embedded profile when it's no longer sRGB?
This tag shouldn't be written to a non-sRGB PNG file, it's precisely because of this the colors look wrong because the viewer thinks the profile is sRGB with g=2.2, but in reality it should be g=1
User avatar
forum_adm
Site Admin
Posts: 1818
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by forum_adm »

Ok, I just added an additional option for sRGB profile handling during the export:
Screenshot 2022-12-12 at 09.37.57.jpg
Screenshot 2022-12-12 at 09.37.57.jpg (36.07 KiB) Viewed 1286 times
es
Posts: 114
Joined: Sun Dec 04, 2022 6:24 pm

Re: How to embed an sRGB profile with g=1.0 after GC conversion

Post by es »

Thank you, but I think this option wouldn't solve this issue since the profile is not sRGB (it has a different gamma value). The proper solution is for the app to notice that the sRGB profile changed (since gamma changed) and embed the correct one (named sRGB with g=1.0, though technically that would not be sRGB anymore)
So the sRGB tag should be unset since the colors are now managed via the non-sRGB embedded profile, correct?

(as a side note: as far as I understand, even if you set a special PNG gamma chunk with 1.0 instead of 2.2, it should be ignored per specification if there is an sRGB chunk tag as this tag supersedes the other chunks)

In general, I agree with your insistence that it's a waste to save sRGB profile, so not sure the option is useful.

At most maybe just add an option "Don't strip existing embedded profile even if it's sRGB (~1-6Kb profile can be replaced with a 13bytes tag)"? Though also not sure what the benefit of preserving the waste is, but maybe I'm missing something
Post Reply