[Closed] convert BMP 32bits to PNG fails

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
luc
Posts: 4
Joined: 2012-11-19T07:34:42-07:00
Authentication code: 6789

[Closed] convert BMP 32bits to PNG fails

Post by luc »

I'm trying to convert BMP 32bits to PNG and I get an Error:
convert.exe: fixed point overflow in cHRM Blue Y `D:\Data2\00_003108.prt.BackView.bmp.png' @ error/png.c/MagickPNGErrorHandler/1751.

What can i do? Any workaround without losing quality?

Thanks
Last edited by luc on 2012-11-21T06:38:05-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert BMP 32bits to PNG fails

Post by fmw42 »

Post a link to your BMP so the IM developers and others can test with it or see if it is corrupt. Also please identify your version of IM and your platform
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: convert BMP 32bits to PNG fails

Post by glennrp »

fmw42 wrote:Post a link to your BMP so the IM developers and others can test with it or see if it is corrupt. Also please identify your version of IM and your platform
Also it would be helpful to know what version of libpng you are using. Type "convert -list format" and look at the "PNG" information to find out.

Also, you can try "convert.exe -define png:exclude-chunk=cHRM file.bmp file.png" to work around the problem.
luc
Posts: 4
Joined: 2012-11-19T07:34:42-07:00
Authentication code: 6789

Re: convert BMP 32bits to PNG fails

Post by luc »

I'm working on Windows 7 64bits

PNG* rw- Portable Network Graphics (libpng 1.5.11)
Version: ImageMagick 6.7.8-0 2012-06-28 Q16
Features: OpenMP

I've also tried:
PNG* rw- Portable Network Graphics (libpng 1.5.13)
Version: ImageMagick 6.8.0-5 2012-11-03 Q16

The file can be downloaded at:
http://dl.free.fr/getfile.pl?file=/eU0xBZMf

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

Re: convert BMP 32bits to PNG fails

Post by glennrp »

I found 57-110452_b.prt.LeftView.rar at the download site
(not "BackView). I unpacked it and saw the same warning about cHRM that
you saw.

"identify -verbose *.bmp" shows this:
Chromaticity:
red primary: (6.87195e+08,3.54335e+08)
green primary: (3.22123e+08,6.44245e+08)
blue primary: (1.61061e+08,6.44245e+07)
white point: (0.3127,0.329)

Those numbers are obviously incorrect; they should be between 0 and 1.
The "-define png:exclude-chunk=cHRM" that I suggested works for me with
this file.
luc
Posts: 4
Joined: 2012-11-19T07:34:42-07:00
Authentication code: 6789

Re: convert BMP 32bits to PNG fails

Post by luc »

Thanks for the information. I know what to check now and how to overide my problem.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: [Closed] convert BMP 32bits to PNG fails

Post by glennrp »

There is a bug in the BMP decoder that reads the chromaticity data incorrectly I have a fix which I'll check in shortly. With the fix, your image will be found to have all "x" and "y" values zero and libpng will not try to write a cHRM chunk. Your image has small nonzero "z" values which mess up the normalization step in the bmp decoder, making the zero "x" and "y" become large numbers. It's a very old bug going back at least to IM-5.5.7, but only recent libpng-1.5.x versions notice it.
luc
Posts: 4
Joined: 2012-11-19T07:34:42-07:00
Authentication code: 6789

Re: [Closed] convert BMP 32bits to PNG fails

Post by luc »

Thanks!
Post Reply