convert -strip fails when wrong sRGB profile

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

convert -strip fails when wrong sRGB profile

Post 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!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert -strip fails when wrong sRGB profile

Post by magick »

Add the +regard-warnings option to your command line.
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

Re: convert -strip fails when wrong sRGB profile

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: convert -strip fails when wrong sRGB profile

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: convert -strip fails when wrong sRGB profile

Post 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.
Post Reply