Page 1 of 1

convert -strip fails when wrong sRGB profile

Posted: 2014-06-26T07:49:56-07:00
by Petr
Not sure if this is a bug.

https://github.com/Faster3ck/Converseen ... erseen.png

Actually, it doesn't fail, it only returns false:

Code: Select all

$ convert converseen.png -strip converseen-stripped.png
Magick: iCCP: known incorrect sRGB profile `converseen.png' @ warning/png.c/MagickPNGWarningHandler/1832.
$ echo $?
1
If I understand correctly, sRGB profile should be removed during -strip, so the command should return 0, am I correct? Second round works:

Code: Select all

$ convert converseen-stripped.png -strip converseen-stripped2.png 
$ echo $?
0
By the way, display renders the original converseen.png image, despite the warning.

Thanks!

Re: convert -strip fails when wrong sRGB profile

Posted: 2014-06-26T09:11:04-07:00
by magick
Add the +regard-warnings option to your command line.

Re: convert -strip fails when wrong sRGB profile

Posted: 2014-06-27T01:55:53-07:00
by Petr
Thanks!

Sorry for this nitpicking. Maybe I am wrong, but stripping profile should not fail nor issue warning even if the profile is incorrect, no?

Note from Glenn:
Try putting this in readpng.c, immediately before png_read_info():

Code: Select all

    #if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && \
        defined(PNG_SET_OPTION_SUPPORTED)
       png_set_option(png, PNG_SKIP_sRGB_CHECK_PROFILE,
           PNG_OPTION_ON);
    #endif
This is a new feature of libpng-1.6.11, to avoid the sRGB profile checking.

Re: convert -strip fails when wrong sRGB profile

Posted: 2014-06-27T04:40:09-07:00
by glennrp
Petr wrote:Thanks!
Sorry for this nitpicking. Maybe I am wrong, but stripping profile should not fail nor issue warning even if the profile is incorrect, no?
The warning occurs during the decoding of the input PNG, before the stripping operation.

Re: convert -strip fails when wrong sRGB profile

Posted: 2014-06-28T10:12:19-07:00
by glennrp
I've added this to coders/png.c in the SVN repo, version 16117 (will be ImageMagick-6.8.9-5):

Code: Select all

png_set_option(png, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);
This suppresses the sRGB profile-checking and resulting warnings.