bug when using --with-quantum-depth=32

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
mark_ecs
Posts: 4
Joined: 2016-08-10T20:20:33-07:00
Authentication code: 1151

bug when using --with-quantum-depth=32

Post by mark_ecs »

using ImageMagick 7.0.2-6 (and some previous versions) built with "--with-quantum-depth=32" on ArchLinux (x86_64) fails to convert from xwd to png.

eg "convert foo.xwd foo.png" produces a png of the correct dimensions but blank.

If rebuilt with the default quantum depth of 16 then the conversion works successfully.

cheers
mark
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: bug when using --with-quantum-depth=32

Post by snibgo »

If you link to an XWD that shows the problem, that would increase the chance of someone looking at the problem.
snibgo's IM pages: im.snibgo.com
mark_ecs
Posts: 4
Joined: 2016-08-10T20:20:33-07:00
Authentication code: 1151

Re: bug when using --with-quantum-depth=32

Post by mark_ecs »

If you link to an XWD that shows the problem, that would increase the chance of someone looking at the problem.
I would have attached a file, but can't do that here so you can get an XWD that demonstrates the problem at the below url:

http://homepages.ecs.vuw.ac.nz/~mark/20 ... 630-02.xwd
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug when using --with-quantum-depth=32

Post by fmw42 »

What was your exact command line that failed? NOTE that IM 7 uses "magick" in place of "convert"

What do you get from regarding features and delegates? Please show everything returned.

Code: Select all

convert -version
IM 7 default install is HDRI. Q16 should be adequate for any needs. Why do you need a Q32 HDRI install?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug when using --with-quantum-depth=32

Post by fmw42 »

PNG does not support 32-bit files. On Q32 with or without HDRI, you need to add -depth 16 to your convert command.

Tiff will support 32-bit files. See -define quantum:format=floating-point at http://www.imagemagick.org/script/formats.php

I have tested on IM 7.0.2-7 with Q16, Q16 HDRI, Q32 and Q32 HDRI. Without the -depth 16, you get results as described for Q32 HDRI. Q32 works mostly but gives black in the smaller window.

If I add -depth 16, it works fine for all above versions.
mark_ecs
Posts: 4
Joined: 2016-08-10T20:20:33-07:00
Authentication code: 1151

Re: bug when using --with-quantum-depth=32

Post by mark_ecs »

What do you get from regarding features and delegates?
% convert -version
Version: ImageMagick 7.0.2-6 Q32 x86_64 2016-08-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI
Delegates (built-in): bzlib fftw fontconfig freetype gslib jng jpeg lcms openexr png ps tiff webp x xml zlib
IM 7 default install is HDRI. Q16 should be adequate for any needs. Why do you need a Q32 HDRI install?
Our graphics group asked for it. I don't know why.
If I add -depth 16, it works fine for all above versions.
OK, I'll pass that on.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug when using --with-quantum-depth=32

Post by fmw42 »

Perhaps your graphics group is confused about 32-bit and 64-bit computers vs needing 32-bit graphics. Q32 tries to make 32-bits per channel not 32-bits per image. 32-bits per image is 8-bits for each RGBA channels. So all you would need would be Q8. But it is better to work with Q16 for better accuracy. Some image formats support 16-bits per channel so 48-bits per image. But PNG is not one of them. Tiff will support 32-bits per channel, but I doubt your graphics group needs that. You probably don't even need HDRI. But default IM 7 comes with Q16 and HDRI.
mark_ecs
Posts: 4
Joined: 2016-08-10T20:20:33-07:00
Authentication code: 1151

Re: bug when using --with-quantum-depth=32

Post by mark_ecs »

No, they were aware of what Q32 was and had some applications when they cared about the extreme accuracy, but didn't expect that enabling it would break other simple operations.

I suppose the surprising thing is that if png doesn't support 32-bit and something tries to do that, that you get a bogus output file rather than a "can't do that" error message.

Anyway, think I'll build the graphics guys a special Q32 version of imagemagick and revert the default one to Q16.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: bug when using --with-quantum-depth=32

Post by snibgo »

This seems to be a bug in IM v7, or perhaps a delegate.

When saving an image to PNG (or any other format), IM should never need telling to reduce the image depth. It should do so by itself.

Using IM v7.0.1-0 Q32 HDRI, Cygwin build on Windows 8.1:

Code: Select all

%IM7DEV%magick 20160810-rt69630-02.xwd x.png
The result is bad, a constant colour, almost white (238/255).

Code: Select all

%IM7DEV%magick 20160810-rt69630-02.xwd -depth 8 x.png
This is the same bad result.

Code: Select all

%IM7DEV%magick 20160810-rt69630-02.xwd -depth 16 x.png
The result looks good (a screen shot).

Using the same three commands with IM 6.9.3-7 Q32 HDRI, Cygwin build on Windows 8.1, "convert" instead of "magick", gives a good result.

Even if IM has (accidentally?) changed so bit-reduction is no longer automatic, this wouldn't explain why "-depth 8" gives a bad result.

EDIT: Another test:

Code: Select all

%IM7DEV%magick 20160810-rt69630-02.xwd +depth x.png
This is the same bad result. I conclude there is certainly a bug.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: bug when using --with-quantum-depth=32

Post by glennrp »

I expect to fix this bug sometime.
kwash
Posts: 17
Joined: 2016-04-30T20:47:29-07:00
Authentication code: 1151

Re: bug when using --with-quantum-depth=32

Post by kwash »

This seems to be a bug in IM v7, or perhaps a delegate.
This is the same bad result. I conclude there is certainly a bug.
I would like to see more words about this. :)
Is it a confirmed bug in IM v7?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug when using --with-quantum-depth=32

Post by fmw42 »

glennrp has said it was a bug (I presume in PNG) and will fix it at some point when he gets time
kwash
Posts: 17
Joined: 2016-04-30T20:47:29-07:00
Authentication code: 1151

Re: bug when using --with-quantum-depth=32

Post by kwash »

glennrp has said it was a bug (I presume in PNG) and will fix it at some point when he gets time
Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bug when using --with-quantum-depth=32

Post by fmw42 »

Sorry, I do not know the details of the issue. Glen is the PNG expert.
Post Reply