Page 1 of 1

PNG with embedded sRGB

Posted: 2013-02-12T04:18:19-07:00
by bjon
Hi

I want to embedd a srgb profile to a png image. Doing that on a jpg everything works fine (i got a "Profiles" section when running identify on output image)
When doing the same thing on a png image everything seems to work (no errors) but "Profiles" section is missing when using identify.

Im i doing something wrong here? Or is this expected?

Re: PNG with embedded sRGB

Posted: 2013-02-12T05:28:57-07:00
by snibgo
The docs say (somewhere; I forget where) that if IM is writing a PNG with sRGB profile, it just sets a PNG flag that says it is sRGB.

Re: PNG with embedded sRGB

Posted: 2013-02-12T05:53:36-07:00
by bjon
Im my case the input png does not have a srgb profile (but got colorspace=sRGB)

Re: PNG with embedded sRGB

Posted: 2013-02-12T06:02:40-07:00
by snibgo
I don't understand. The input has no profile, and you are not adding one, but expect the output to contain a profile?

Can you provide the exact command you are using, and the input file?

Re: PNG with embedded sRGB

Posted: 2013-02-12T06:07:37-07:00
by glennrp
snibgo wrote:The docs say (somewhere; I forget where) that if IM is writing a PNG with sRGB profile, it just sets a PNG flag that says it is sRGB.
That's correct. The PNG spec defines the "sRGB" chunk that carries only one byte: the "intent". We write that instead of the full sRGB profile. Any application
that understands ICC profiles is supposed to also recognize the PNG sRGB chunk and handle it as though a full sRGB profile were present.

Re: PNG with embedded sRGB

Posted: 2013-02-12T06:35:47-07:00
by bjon
snibgo wrote:I don't understand. The input has no profile, and you are not adding one, but expect the output to contain a profile?

Can you provide the exact command you are using, and the input file?

Code: Select all

convert input.png -profile srgb.icc output.png

Re: PNG with embedded sRGB

Posted: 2013-02-12T06:37:29-07:00
by bjon
glennrp wrote:
snibgo wrote:The docs say (somewhere; I forget where) that if IM is writing a PNG with sRGB profile, it just sets a PNG flag that says it is sRGB.
That's correct. The PNG spec defines the "sRGB" chunk that carries only one byte: the "intent". We write that instead of the full sRGB profile. Any application
that understands ICC profiles is supposed to also recognize the PNG sRGB chunk and handle it as though a full sRGB profile were present.
Aha now i got it :)
Thanks for the clarification!

Re: PNG with embedded sRGB

Posted: 2013-02-12T07:23:11-07:00
by snibgo
Just to add to the explanation:

If input.png has a profile, your command will convert the pixel values and add the profile. Otherwise, it will just add the profile. Then, because you are saving sRGB as PNG, it will save the sRGB chunk rather than inserting the actual profile in the file.