The documentation for "-intensity" (http://www.imagemagick.org/script/comma ... #intensity) claims Lightness is the average of the min and max RGB values, and that "-grayscale" should do the same.
Code: Select all
Lightness (min(R', G', B') + max(R', G', B')) / 2.0
Code: Select all
D:\web\im>c:\im\ImageMagick-6.8.5-8-Q16\convert xc:red xc:yellow xc:brown xc:rgb(100,110,120) xc:rgb(50,150,200) -append test.png
D:\web\im>c:\im\ImageMagick-6.8.5-8-Q16\convert test.png txt:
# ImageMagick pixel enumeration: 1,5,255,srgb
0,0: (255, 0, 0) #FF0000 red
0,1: (255,255, 0) #FFFF00 yellow
0,2: (165, 42, 42) #A52A2A brown
0,3: (100,110,120) #646E78 srgb(100,110,120)
0,4: ( 50,150,200) #3296C8 srgb(50,150,200)
D:\web\im>c:\im\ImageMagick-6.8.5-8-Q16\convert test.png -grayscale Lightness txt:
# ImageMagick pixel enumeration: 1,5,255,gray
0,0: ( 0, 0, 0) #000000 gray(0)
0,1: ( 0, 0, 0) #000000 gray(0)
0,2: ( 42, 42, 42) #2A2A2A gray(42)
0,3: (100,100,100) #646464 gray(100)
0,4: ( 50, 50, 50) #323232 gray(50)
Code: Select all
D:\web\im>c:\im\ImageMagick-6.8.5-8-Q16\convert test.png -grayscale Rec601Luma txt:
# ImageMagick pixel enumeration: 1,5,255,gray
0,0: ( 76, 76, 76) #4C4C4C gray(76)
0,1: (226,226,226) #E2E2E2 gray(226)
0,2: ( 79, 79, 79) #4F4F4F gray(79)
0,3: (108,108,108) #6C6C6C gray(108)
0,4: (126,126,126) #7E7E7E gray(126)
D:\web\im>c:\im\ImageMagick-6.8.5-8-Q16\convert test.png -grayscale Rec601Luminance txt:
# ImageMagick pixel enumeration: 1,5,255,gray
0,0: ( 76, 76, 76) #4C4C4C gray(76)
0,1: (226,226,226) #E2E2E2 gray(226)
0,2: ( 79, 79, 79) #4F4F4F gray(79)
0,3: (108,108,108) #6C6C6C gray(108)
0,4: (126,126,126) #7E7E7E gray(126)