HDRI -statistic minimum and maximum

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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

HDRI -statistic minimum and maximum

Post by snibgo »

With HDRI, "-statistic minimum" and "-statistic maximum" are wrong. They are too large. (I haven't test the other "statistic" options.)

These used to work, in older v6 versions.

For example, with v7.0.7-28, Q16 HDRI:

Code: Select all

f:\web\im>c:\ProgramFiles\ImageMagick-7.0.7-28-Q16-HDRI\magick -size 5x1 xc:gray
(50%) -define quantum:format=floating-point -depth 32 x.miff

f:\web\im>c:\ProgramFiles\ImageMagick-7.0.7-28-Q16-HDRI\magick x.miff -precision 19 txt:
# ImageMagick pixel enumeration: 5,1,65535,gray
0,0: (32767.5)  #800080008000  gray(50%)
1,0: (32767.5)  #800080008000  gray(50%)
2,0: (32767.5)  #800080008000  gray(50%)
3,0: (32767.5)  #800080008000  gray(50%)
4,0: (32767.5)  #800080008000  gray(50%)

f:\web\im>c:\ProgramFiles\ImageMagick-7.0.7-28-Q16-HDRI\magick x.miff -statistic minimum 1x1 -precision 19 txt:
# ImageMagick pixel enumeration: 5,1,65535,gray
0,0: (32768)  #800080008000  gray(50.000762939453125%)
1,0: (32768)  #800080008000  gray(50.000762939453125%)
2,0: (32768)  #800080008000  gray(50.000762939453125%)
3,0: (32768)  #800080008000  gray(50.000762939453125%)
4,0: (32768)  #800080008000  gray(50.000762939453125%)

f:\web\im>c:\ProgramFiles\ImageMagick-7.0.7-28-Q16-HDRI\magick x.miff -statistic maximum 1x1 -precision 19 txt:
# ImageMagick pixel enumeration: 5,1,65535,gray
0,0: (32768)  #800080008000  gray(50.000762939453125%)
1,0: (32768)  #800080008000  gray(50.000762939453125%)
2,0: (32768)  #800080008000  gray(50.000762939453125%)
3,0: (32768)  #800080008000  gray(50.000762939453125%)
4,0: (32768)  #800080008000  gray(50.000762939453125%)
It is also wrong with a home-compiled v6.9.9-40 Q32 HDRI:

Code: Select all

f:\web\im>C:\cygwin64\home\Alan\imdevins69940\bin\convert -size 5x1 xc:gray(50%)
 -define quantum:format=floating-point -depth 32 x.miff
 
f:\web\im>C:\cygwin64\home\Alan\imdevins69940\bin\convert x.miff -precision 19 txt:
# ImageMagick pixel enumeration: 5,1,4294967295,gray
0,0: (2147483648,2147483648,2147483648)  #800000008000000080000000  gray(50.0000
0001164153218%)
1,0: (2147483648,2147483648,2147483648)  #800000008000000080000000  gray(50.0000
0001164153218%)
2,0: (2147483648,2147483648,2147483648)  #800000008000000080000000  gray(50.0000
0001164153218%)
3,0: (2147483648,2147483648,2147483648)  #800000008000000080000000  gray(50.0000
0001164153218%)
4,0: (2147483648,2147483648,2147483648)  #800000008000000080000000  gray(50.0000
0001164153218%)

f:\web\im>C:\cygwin64\home\Alan\imdevins69940\bin\convert x.miff -statistic mini
mum 1x1 -precision 19 txt:
# ImageMagick pixel enumeration: 5,1,4294967295,gray
0,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
1,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
2,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
3,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
4,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)

f:\web\im>C:\cygwin64\home\Alan\imdevins69940\bin\convert x.miff -statistic maxi
mum 1x1 -precision 19 txt:
# ImageMagick pixel enumeration: 5,1,4294967295,gray
0,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
1,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
2,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
3,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
4,0: (2147516416,2147516416,2147516416)  #800080008000800080008000  gray(50.0007
6295109483482%)
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: HDRI -statistic minimum and maximum

Post by snibgo »

Looking at statistic.c in v7.0.7-28, it seems to assume pixel values can be stored in type size_t, which I think is integer. So the output is always an integer, and any "-statistic" is generally wrong for HDRI.

So the maximum of two equal non-integer values can be greater than them, or less than them.
snibgo's IM pages: im.snibgo.com
Post Reply