Possible bug: -intensity has no effect on -white-threshold?.

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
Dabrosny
Posts: 111
Joined: 2013-10-02T10:49:39-07:00
Authentication code: 6789
Location: New York, US

Possible bug: -intensity has no effect on -white-threshold?.

Post by Dabrosny »

The -intensity setting appears to have no effect on the result of applying some of the operators they are said to affect, for example the -white-threshold operator:

Code: Select all

imh convert rose: -intensity rec709luminance -white-threshold 32768  -format "%[colorspace] %[fx:mean]\n" -write info: roseIntLumINANCE.png
sRGB 0.469752
imh convert rose: -intensity rec709luma -white-threshold 32768  -format "%[colorspace] %[fx:mean]\n" -write info: roseIntLumA.png
sRGB 0.469752
The resulting images appear to be the same (not just their means) but I was expecting them to be different because one uses -intensity rec709lumINANCE while the other uses nonlinear rec709lumA.

Is this a bug?

ImageMagick 6.8.7-0 2013-09-30 Q16 DPC HDRI Cygwin under Win7 64bit
Last edited by Dabrosny on 2013-11-01T15:19:43-07:00, edited 2 times in total.
-Dabrosny [Using IM7.0.6 or higher, Q16 HDRI x64 native executable, command line, often invoked from cygwin bash/sh (as of Aug. 2017)]
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug: -intensity has no effect on -white-thresho

Post by fmw42 »

I get the same results as you. I am using 6.8.7.5 beta Q16

Code: Select all

imb convert rose: -depth 16 -intensity rec709luminance -white-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumINANCE.png
0.469752 sRGB TrueColor 0.454545

Code: Select all

imb convert rose: -depth 16 -intensity rec709luma -white-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumA.png
0.469752 sRGB TrueColor 0.454545
It would appear that -intensity rec709luminance -white-threshold is not sensing the linearity for luminance


Same for -black-threshold

Code: Select all

imb convert rose: -depth 16 -intensity rec709luminance -black-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumINANCE.png
0.216191 sRGB TrueColor 0.454545

Code: Select all

imb convert rose: -depth 16 -intensity rec709luma -black-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumA.png
0.216191 sRGB TrueColor 0.454545

Though it partially works for -threshold as in my independent bug report
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug: -intensity has no effect on -white-thresho

Post by fmw42 »

I believe that currently the way that -intensity rec709luminance works with function other than -colorspace gray, is that it needs to be preceded by -colorspace RGB. The conversion to gamma=1 is not automatic as it is with -intensity rec709luminance -colorspace gray.

Testing in IM 6.8.7.5 beta, I get the following

-black-threshold:

Code: Select all

imb convert rose: -depth 16 -colorspace RGB -intensity rec709luminance -black-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumINANCE.png
0.136732 RGB TrueColor 1

 imb convert rose: -depth 16 -intensity rec709luma -black-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumA.png
0.216191 sRGB TrueColor 0.454545
-white-threshold

Code: Select all

imb convert rose: -depth 16 -colorspace RGB -intensity rec709luminance -white-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumINANCE.png
0.253591 RGB TrueColor 1

imb convert rose: -depth 16 -intensity rec709luma -white-threshold 32768  -format "%[fx:mean] %[colorspace] %[type] %[gamma]\n" -write info: roseIntLumA.png
0.469752 sRGB TrueColor 0.454545
Post Reply