libpng warning: Ignoring incorrect gAMA value when sRGB is also present

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
cbelth
Posts: 2
Joined: 2016-07-05T16:24:52-07:00
Authentication code: 1151

libpng warning: Ignoring incorrect gAMA value when sRGB is also present

Post by cbelth »

I have run the command:

Code: Select all

convert -flop image.png mirrored_image.png
to mirror an image. It worked, and examining the result, it is correct. However, I then went to resize the result with the following:

Code: Select all

convert mirrored_image.png -resize 256x256 resize_image.png
and it throws the following error:
libpng warning: Ignoring incorrect gAMA value when sRGB is also present
Anyone know how to solve this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: libpng warning: Ignoring incorrect gAMA value when sRGB is also present

Post by fmw42 »

What is your IM version and platform? Please always provide that. See viewtopic.php?f=1&t=9620

Also what is your version of libpng? It might be old and need an update.You can find it from

Code: Select all

convert -list format
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: libpng warning: Ignoring incorrect gAMA value when sRGB is also present

Post by snibgo »

The problem is probably this:

In some versions of IM (or perhaps some versions of linpng), using "-gamma XX" to adjust mid-tones of pixels would also adjust the metadata gamma setting. But some versions of IM or libpng expect the gamma metadata to always be 0.454545 when a sRGB profile is present.

The cure is not to use "-gamma XX", but "-evaluate Pow YY" where YY = 1/XX.

When a file shows this warning, the workaround is "-set gamma 0.454545". This changes the metadata without changing the pixels.
snibgo's IM pages: im.snibgo.com
Post Reply