Warning turned into an error

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.
Posts: 467
Joined: 2008-12-21T11:51:10-07:00

Warning turned into an error

Post by broucaries »

Dear Maintainer,

Recently my package lazarus FTBFS (see bug 761536). The problem is apparently
a png file that we convert during build. As you can see from the loggings of
the past builds we have seen the warning below for ages, but suddenly the warning
turned into an error (while the message still says "warning"). I am wondering if
that was intended. (If yes, I couldn'd find what the problem is with the file,
an advice on improving the figure is also appreciated).

(pbuild1845) wollumbin lazarus-1.2.4+dfsg # identify images/ide_icon48x48.png || echo we got an error
images/ide_icon48x48.png PNG 48x48 48x48+0+0 8-bit sRGB 4.24KB 0.010u 0:00.019
identify: tRNS chunk not allowed with alpha channel `images/ide_icon48x48.png' @ warning/png.c/MagickPNGWarningHandler/1831.
we got an error

User avatar
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Warning turned into an error

Post by glennrp »

In libpng-1.6.0 and later, the "tRNS not allowed with alpha channel" became a "benign error" instead of a warning, and the message
was change to "tRNS: invalid with alpha channel". But ImageMagick coders/png.c has a call "png_set_benign_errors(ping,1)" which
is supposed to cause libpng to treat them as warnings. What are your versions of ImageMagick and libpng? Because of the format
of the warning, I think you are using libpng 1.5 or earlier, which just calls png_warning() for this situation.

I don't know why "identify" and "convert" return a non-zero when there is a PNG warning. This is also happening for me when I use
an up-to-date libpng16. The warning handler seems to be setting exception properly (CoderWarning):

Code: Select all

 (void) ThrowMagickException(&image->exception,GetMagickModule(),CoderWarning, message,"`%s'",image->filename);
at line 1831 in coders/png.c. I'm just guessing that the bug is in the exception handler and not in the PNG codec.

You can use "pngcrush in.png out.png" to fix the png file (pngcrush issues a warning and removes the tRNS chunk)

The bug appears to have been introduced in ImageMagick-6.8.9-2 (-1 behaves properly).

This diff between IM-6.8.9-1 and IM-6.8.9-2 looks suspicious:

Code: Select all

glenn.rp> diff [12]/u*/identify.c
<   return(status == MagickFalse ? 0 : 1);
>   return(status != MagickFalse ? 0 : 1);
<   return(status == MagickFalse ? 0 : 1);
>   return(status != MagickFalse ? 0 : 1);

User avatar
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: Warning turned into an error

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-9 Beta, available by sometime tomorrow. Thanks.