-linear-stretch

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
afre
Posts: 57
Joined: 2014-01-22T15:02:53-07:00
Authentication code: 6789

-linear-stretch

Post by afre »

For ImageMagick 6.9.0-6 Q32 x86_64 (WIN) when doing

Code: Select all

convert logo: -linear-stretch 5x5 logo.png
all or some of the image turns white, like this.
ImageMagick 7.0.7-25 Q16 x64 2018-03-04 · Cipher DPC HDRI Modules OpenMP · Windows 7
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -linear-stretch

Post by fmw42 »

Your command works fine for me on the logo image on IM 6.9.0.7 Q16 Mac OSX. If it is on other images, then post the input and your output.

Note that 5x5 is just 5 graylevels out of 65535 on Q16. It should be miniscule on Q32. I always use percents rather than raw values so that it does not matter what Q level I am using. I don't really use Q32. If I want high quality, I use Q16 HDRI. I do not see much point in Q32. But perhaps you have a requirement that I have not given consideration.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -linear-stretch

Post by snibgo »

For v6.9.0-0 on Windows 8.1:

The Windows standard Q16 integer distribution does not show this bug.

On self-compiled (with Cygwin):

Q8 and Q16 (integer and HDRI) don't show the bug.

Q32 and Q64, integer and HDRI, do show the bug.

I suspect the bug is similar to one I reported some time ago, where an array index was mis-scaled.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -linear-stretch

Post by snibgo »

I haven't checked this by applying a patch, but I think the problem is in enhance.c. Function LevelImageChannel() has parameters black_point and white_point, which that function thinks are in the range 0 to QuantumRange. However, it is frequently called with those parameters in the range 0 to MaxMap.

For Q8 and Q16, MaxMap == QuantumRange. For Q32 and Q64, MaxMap != QuantumRange.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -linear-stretch

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.9.0-8 Beta, available by sometime tomorrow. Thanks.
Post Reply