PNG with embedded sRGB

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bjon
Posts: 4
Joined: 2013-02-12T04:13:04-07:00
Authentication code: 6789

PNG with embedded sRGB

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PNG with embedded sRGB

Post 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.
snibgo's IM pages: im.snibgo.com
bjon
Posts: 4
Joined: 2013-02-12T04:13:04-07:00
Authentication code: 6789

Re: PNG with embedded sRGB

Post by bjon »

Im my case the input png does not have a srgb profile (but got colorspace=sRGB)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PNG with embedded sRGB

Post 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?
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG with embedded sRGB

Post 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.
bjon
Posts: 4
Joined: 2013-02-12T04:13:04-07:00
Authentication code: 6789

Re: PNG with embedded sRGB

Post 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
bjon
Posts: 4
Joined: 2013-02-12T04:13:04-07:00
Authentication code: 6789

Re: PNG with embedded sRGB

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PNG with embedded sRGB

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply