Page 1 of 1

libpng-1.6.x rejects the sRGB profile in logo:

Posted: 2013-04-17T06:03:51-07:00
by glennrp
Libpng-1.6.x does more checking of ICC profiles and in particular
rejects some "sRGB" profiles that were previously acceptable to
ImageMagick. The profile embedded in "logo:" is among them.

glenn.rp> q16identify -list format | grep PNG
  • PNG* rw- Portable Network Graphics (libpng 1.6.2beta02)
    See http://www.libpng.org/ for details about the PNG format.
    PNG00* rw- PNG inheriting bit-depth and color-type from original
    PNG24* rw- opaque or binary transparent 24-bit RGB (zlib 1.2.7.1)
    PNG32* rw- opaque or transparent 32-bit RGBA
    PNG48* rw- opaque or binary transparent 48-bit RGB
    PNG64* rw- opaque or transparent 64-bit RGBA
    PNG8* rw- 8-bit indexed with optional binary transparency
glenn.rp> q16convert logo: logo.png
q16convert: known incorrect sRGB profile `logo.png' @ error/png.c/MagickPNGErrorHandler/1761.
glenn.rp>

libpng-1.6.1/png.c says
  • if (png_sRGB_checks.is_broken)
    {
    /* These profiles are known to have bad data that may cause
    * problems if they are used, therefore attempt to
    * discourage their use, skip the 'have_md5' warning below,
    * which is made irrelevant by this error.
    */
    png_chunk_report(png_ptr, "known incorrect sRGB profile",
    PNG_CHUNK_ERROR);
    }

    /* Warn that this being done; this isn't even an error since
    * the profile is perfectly valid, but it would be nice if
    * people used the up-to-date ones.
    */

I'm getting more than just a warning. "convert" doesn't write an
output PNG. I got the same behavior with ImageMagick built with
libpng-1.6.1 and running with the 1.6.2beta02 shared library.

I have checked in a simple fix (adding a call to png_set_benign_errors())
that causes IM to issue a warning instead of an error. SVN r 11879.

With the fix I get
glenn.rp> q16convert logo: logo.png
q16convert: known incorrect sRGB profile `logo.png' @ warning/png.c/MagickPNGWarningHandler/1787.
q16convert: profile 'sRGB': 0h: inconsistent rendering intents `logo.png' @ warning/png.c/MagickPNGWarningHandler/1787.
glenn.rp>

and logo.png is written without an iCCP chunk.

Re: libpng-1.6.x rejects the sRGB profile in logo:

Posted: 2013-04-17T09:33:45-07:00
by magick
Thanks Glenn, we'll try and fix the sRGB profile, that should ameliorate the problem.

Re: libpng-1.6.x rejects the sRGB profile in logo:

Posted: 2013-04-17T21:54:14-07:00
by glennrp
magick wrote:Thanks Glenn, we'll try and fix the sRGB profile, that should ameliorate the problem.
We'll want to replace it with one that has a "free" license (the one currently embedded in "logo:" has
a license that prevents modifying it so is non-free). I recommend the sRGB profile supplied with Argyllcms;
it is public domain and appears to be a good one.