I just checked IM 6.4.1-0 Q16-hdri for channels:
(reference and follow-up to viewtopic.php?f=3&t=10984)
convert -list channel
All
Alpha
Black
Blue
Cyan
Default
Gray
Green
Hue
Index
Lightness
Luminance
Luminosity
Magenta
Matte
Opacity
Red
Saturation
Yellow
1) I see lightness, luminance and luminosity. I was under the impression that in -fx luminosity was replaced by lightness. Is there a difference here between these 3 channels? or at least between lightness and luminosity?
2) I tried to make a comparison as follows just for luminance:
convert rose: -channel luminance -fx "u" rose_channel_fx_luminance.png
convert rose: -fx "luminance" rose_fx_luminance.png
compare -metric rmse rose_channel_fx_luminance.png rose_fx_luminance.png null:
36451.2 (0.55621)
Should they be the same or am I misunderstanding how to do this.
3) Is there a colorspace equivalent to either of the above, e.g.
convert rose: -colorspace ??? -channel luminance -separate rose_luminance.png
and would this colorspace be Rec601Luma or Rec709Luma
4) or should either
convert rose: -colorspace Rec601Luma rose_luma601.png
or
convert rose: -colorspace Rec709Luma rose_luma601.png
match one of the following:
convert rose: -channel luminance -fx "u" rose_channel_fx_luminance.png
or
convert rose: -fx "luminance" rose_fx_luminance.png
This is low priority, but a clarification when convenient would be appreciated.
Thanks
Fred
puzzled about luminance - possible bug
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
puzzled about luminance - possible bug
Last edited by fmw42 on 2008-04-30T22:05:05-07:00, edited 1 time in total.
Re: puzzled about luminance
Luminosity is deprecated. Luminance and lightness are aliases to the blue channel. For proper lightness you need to read the original image in the HSL colorspace or explicitly convert to the HSL colorspace. However, the -fx lightness operator does the colorspace conversion automatically with the ConvertRGBToHSL() method.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: puzzled about luminance
Thanks. But I am still puzzled by luminance.
1) It is the blue channel of what colorspace?
2) And does it have any relationship to Rec601Luma or Rec709Luma?
Your earlier note:
Would this imply:
convert rose: -colorspace rec709Luma -channel blue rose_lumnance.png
If so, then what is -channel luminance mean and how is it used?
3) And does -fx do the colorspace conversion as well for luminance (like for lightness)?
Sorry, this is very confusing to me.
1) It is the blue channel of what colorspace?
2) And does it have any relationship to Rec601Luma or Rec709Luma?
Your earlier note:
would seem to imply they are the same, but I am confused. Is rec709Luma a single channel colorspace or a 3 channel colorspace?luma=Rec709LumaColorspace (e.g. 0.2126*red + 0.7152*green + 0.0722*blue).
and
-fx luminance (new) becomes 0.2126*red + 0.7152*green + 0.0722*blue
Would this imply:
convert rose: -colorspace rec709Luma -channel blue rose_lumnance.png
If so, then what is -channel luminance mean and how is it used?
3) And does -fx do the colorspace conversion as well for luminance (like for lightness)?
Sorry, this is very confusing to me.
Re: puzzled about luminance
ImageMagick supports up to 5 channels of color information and are labeled based on the colorspace:
- channel 1: one of Red, Cyan, Hue, Grayscale, etc.
2: Green, Magenta, Saturation, Grayscale, etc.
3: Blue, Yellow, Lightness, Grayscale, etc.
4: Alpha
5: Index, Black
- 0.2126*red + 0.7152*green + 0.0722*blue
- QuantumScale*0.2126*pixel.red+0.7152*pixel.green+0.0722*pixel.blue;
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: puzzled about luminance - possible bug
Sorry to keep pressing the issue, but by your statements, I would think that the following would create the same results:
convert rose: -colorspace Rec709Luma rose_Rec709Luma.png
convert rose: -fx "luminance" rose_fx_luminance.png
But they do not:
compare -metric rmse rose_Rec709Luma.png rose_fx_luminance.png null:
35967.2 (0.548825)
If I get verbose info:
convert rose_Rec709Luma.png -verbose info:
...
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
gray:
min: 9488 (0.144778)
max: 65535 (1)
mean: 25861.2 (0.394616)
standard deviation: 12281.8 (0.187408)
which looks reasonable, but
convert rose_fx_luminance.png -verbose info:
...
Type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 16/1-bit
Channel depth:
gray: 1-bit
Channel statistics:
gray:
min: 1 (1)
max: 1 (1)
mean: 1 (1)
standard deviation: -0 (-0)
does not appear reasonable as the resulting image has a constant value of 1!
Is this a bug? Am I doing something wrong with my convert statements? Have I misunderstood? Or is this due the my being on (IM 6.4.1-0) Q16-HDRI
Note: if I do the same with lightness:
convert rose: -fx "lightness" rose_fx_lightness.png
convert rose_fx_lightness.png -verbose info:
...
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
gray:
min: 9509 (0.145098)
max: 65535 (1)
mean: 29310.8 (0.447254)
standard deviation: 13019.8 (0.198669)
or if I do the same with intensity:
convert rose: -fx "intensity" rose_fx_intensity.png
convert rose_fx_intensity.png -verbose info:
...
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
gray:
min: 9578 (0.146151)
max: 65535 (1)
mean: 27020.2 (0.412302)
standard deviation: 12177.1 (0.18581)
I do not get the constant value of 1 like I do with luminance, above. So I am thinking that the -fx "luminance" result is a bug.
Thanks.
Fred
P.S. What then is the significance/use of -channel luminance? How is that used and how is it different from the above two approaches?
convert rose: -colorspace Rec709Luma rose_Rec709Luma.png
convert rose: -fx "luminance" rose_fx_luminance.png
But they do not:
compare -metric rmse rose_Rec709Luma.png rose_fx_luminance.png null:
35967.2 (0.548825)
If I get verbose info:
convert rose_Rec709Luma.png -verbose info:
...
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
gray:
min: 9488 (0.144778)
max: 65535 (1)
mean: 25861.2 (0.394616)
standard deviation: 12281.8 (0.187408)
which looks reasonable, but
convert rose_fx_luminance.png -verbose info:
...
Type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 16/1-bit
Channel depth:
gray: 1-bit
Channel statistics:
gray:
min: 1 (1)
max: 1 (1)
mean: 1 (1)
standard deviation: -0 (-0)
does not appear reasonable as the resulting image has a constant value of 1!
Is this a bug? Am I doing something wrong with my convert statements? Have I misunderstood? Or is this due the my being on (IM 6.4.1-0) Q16-HDRI
Note: if I do the same with lightness:
convert rose: -fx "lightness" rose_fx_lightness.png
convert rose_fx_lightness.png -verbose info:
...
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
gray:
min: 9509 (0.145098)
max: 65535 (1)
mean: 29310.8 (0.447254)
standard deviation: 13019.8 (0.198669)
or if I do the same with intensity:
convert rose: -fx "intensity" rose_fx_intensity.png
convert rose_fx_intensity.png -verbose info:
...
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
gray:
min: 9578 (0.146151)
max: 65535 (1)
mean: 27020.2 (0.412302)
standard deviation: 12177.1 (0.18581)
I do not get the constant value of 1 like I do with luminance, above. So I am thinking that the -fx "luminance" result is a bug.
Thanks.
Fred
P.S. What then is the significance/use of -channel luminance? How is that used and how is it different from the above two approaches?
Re: puzzled about luminance - possible bug
We fixed an associative multiply problem when computing luminence for the -fx option in ImageMagick 6.4.1-1 Beta available sometime tomorrow.