possible bug in -contrast-stretch 0 in IM 6.4.2-4
Posted: 2008-07-25T15:17:03-07:00
Testing IM 6.4.2-4 Q16 non-hdri on Mac OSX 10.4.11 Tiger
Convert rose to gif for testing:
convert rose: rose.gif
Get channel statistics:
convert rose.gif -separate -format "%[min]" info:
10794
6682
7453
convert rose.gif -separate -format "%[max]" info:
65535
65278
65535
Test1: Does not work fully!
convert rose.gif -contrast-stretch 0 rose_cs0.gif
convert rose_cs0.gif -separate -format "%[min]" info:
257
0
0
convert rose_cs0.gif -separate -format "%[max]" info:
65535
65535
65535
Test2: Works fine
convert rose.gif -channel rgb -contrast-stretch 0 rose_cs0.gif
convert rose_cs0.gif -separate -format "%[min]" info:
0
0
0
freds-mac-mini:~ fred$ convert rose_cs0.gif -separate -format "%[max]" info:
65535
65535
65535
In case 1, if, for some reason, the code is using the composite histogram of all channels to do the stretch, then I would expect that it should be using the smallest minimum of r,g,b and the largest maximum of r,g,b as the extremes. But it does not seem to be doing that.
Convert rose to gif for testing:
convert rose: rose.gif
Get channel statistics:
convert rose.gif -separate -format "%[min]" info:
10794
6682
7453
convert rose.gif -separate -format "%[max]" info:
65535
65278
65535
Test1: Does not work fully!
convert rose.gif -contrast-stretch 0 rose_cs0.gif
convert rose_cs0.gif -separate -format "%[min]" info:
257
0
0
convert rose_cs0.gif -separate -format "%[max]" info:
65535
65535
65535
Test2: Works fine
convert rose.gif -channel rgb -contrast-stretch 0 rose_cs0.gif
convert rose_cs0.gif -separate -format "%[min]" info:
0
0
0
freds-mac-mini:~ fred$ convert rose_cs0.gif -separate -format "%[max]" info:
65535
65535
65535
In case 1, if, for some reason, the code is using the composite histogram of all channels to do the stretch, then I would expect that it should be using the smallest minimum of r,g,b and the largest maximum of r,g,b as the extremes. But it does not seem to be doing that.