IM 6.8.7.1 beta
I am not sure, but should not these two produce the same results:
-grayscale rec709luminance
and
-colorspace gray -colorspace RGB
# First, check that -colorspace gray, -colorspace rec709luma and -grayscale rec709luma are the same (which they are)
imbh convert rose: -colorspace gray rose_gray1.png
imbh convert rose: -colorspace rec709luma rose_gray2.png
imbh compare -metric rmse rose_gray1.png rose_gray2.png null:
0 (0)
imbh convert rose: -colorspace gray rose_gray1.png
imbh convert rose: -grayscale rec709luma rose_gray3.png
imbh compare -metric rmse rose_gray1.png rose_gray3.png null:
0 (0)
Now test the two commands:
imbh convert rose: -grayscale rec709luminance rose_linear1.png
Image: rose_linear1.png
Geometry: 70x46+0+0
Page geometry: 70x46+0+0
Class: PseudoClass
Colorspace: Gray
Type: Grayscale
Depth: 8/1-bit
Alpha: False
Channels: gray
Rendering intent: Undefined
Gamma: 1
Colors: 200
Gray:
min: 5 (0.0196078)
max: 255 (1)
mean: 49.9761 (0.195985)
standard deviation: 53.9087 (0.211407)
imbh convert rose: -colorspace gray -colorspace RGB rose_linear2.png
Image: rose_linear2.png
Geometry: 70x46+0+0
Page geometry: 70x46+0+0
Class: PseudoClass
Colorspace: Gray
Type: Grayscale
Depth: 8/1-bit
Alpha: False
Channels: gray
Rendering intent: Undefined
Gamma: 1
Colors: 203
Gray:
min: 5 (0.0196078)
max: 255 (1)
mean: 43.3106 (0.169845)
standard deviation: 54.5687 (0.213995)
I would think that these should be the same, but are not quite. The means and std are different.
imbh compare -metric rmse rose_linear2.png rose_linear1.png null:
2886.83 (0.0440501)
[RESOLVED]possible bug -colorspace gray -colorspace RGB
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
[RESOLVED]possible bug -colorspace gray -colorspace RGB
Last edited by fmw42 on 2013-10-17T10:00:06-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: possible bug -colorspace gray -colorspace RGB
"-colorspace gray" is same as "-grayscale Rec709Luma", not "-grayscale Rec709Luminance". I don't know if this behaviour is correct or not.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug -colorspace gray -colorspace RGB
You are correct. With -colorspace gray -colorspace RGB, I was trying to generate a linear grayscale image from rec709luma that I thought would be the same as rec709luminance.snibgo wrote:"-colorspace gray" is same as "-grayscale Rec709Luma", not "-grayscale Rec709Luminance". I don't know if this behaviour is correct or not.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug -colorspace gray -colorspace RGB
From Magick:
1) convert rose: -grayscale rec709luminance rose_linear1.png
2) convert rose: -colorspace gray -colorspace RGB rose_linear2.png
3) compare -metric rmse rose_linear2.png rose_linear1.png null:
2886.83 (0.0440501)
These are correct and expected results. 1) first decompands each sRGB pixel component then computes linear gray as follows:
R=DecodePixelGamma(R');
G=DecodePixelGamma(G');
B=DecodePixelGamma(B');
I=0.212656*R+0.715158*G+0.072186*B
whereas 2) computes the luma gray first then decompands to return linear RGB. So
G'=0.212656*R'+0.715158*G'+0.072186*B'
R'=G
G'=G
B'=G
R=DecodePixelGamma(R');
G=DecodePixelGamma(G');
B=DecodePixelGamma(B');
The correct equivalence to 1) is:
convert rose: -colorspace RGB -intensity Rec709luminance -colorspace gray rose_linear2.png
compare -metric rmse rose_linear2.png rose_linear1.png null:
0 (0)
1) convert rose: -grayscale rec709luminance rose_linear1.png
2) convert rose: -colorspace gray -colorspace RGB rose_linear2.png
3) compare -metric rmse rose_linear2.png rose_linear1.png null:
2886.83 (0.0440501)
These are correct and expected results. 1) first decompands each sRGB pixel component then computes linear gray as follows:
R=DecodePixelGamma(R');
G=DecodePixelGamma(G');
B=DecodePixelGamma(B');
I=0.212656*R+0.715158*G+0.072186*B
whereas 2) computes the luma gray first then decompands to return linear RGB. So
G'=0.212656*R'+0.715158*G'+0.072186*B'
R'=G
G'=G
B'=G
R=DecodePixelGamma(R');
G=DecodePixelGamma(G');
B=DecodePixelGamma(B');
The correct equivalence to 1) is:
convert rose: -colorspace RGB -intensity Rec709luminance -colorspace gray rose_linear2.png
compare -metric rmse rose_linear2.png rose_linear1.png null:
0 (0)