Converting an sRGB PNG file to LAB colorspace before separating channels works fine; however if I attempt to limit it to a specific LAB channel the output is inconsistent. (I get the same results if I start with a LAB colorspace TIFF and don't perform any colorspace conversion.)
magick foo.png -colorspace CIELab -separate foo_channel_%d.png
(works; channel_0 = Lightness, channel_1 = A, channel_2 = B, channel_3 = Alpha)
Limiting the output to a specific channel:
magick foo.png -colorspace CIELab -channel X -separate foo_channel_X.png (where X is one of Lightness|A|B|Alpha)
I get the following:
Channel L generates B output
Channel A generates Alpha output
Channel B generates B output
Channel Alpha generates Alpha output
magick -version
Version: ImageMagick 7.0.2-7 Q8 x64 2016-08-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
bug when extracting single LAB channel
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: bug when extracting single LAB channel
How are you specifying -channel X. IM does not use L(or lightness),A,B for channels nor channel numbers for LAB. A is always alpha. You need to use R,G,B to correspond to L,A,B.
see http://www.imagemagick.org/script/comma ... hp#channel
see http://www.imagemagick.org/script/comma ... hp#channel
Re: bug when extracting single LAB channel
Ah. I assumed the channel names should have corresponded to those provided by "-list channel". (The docs do suggest this: "To print a complete list of channel types, use -list channel."). But I see they are explicitly not valid '-channel' inputs per the docs.
Thank you for the clarification.
Thank you for the clarification.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: bug when extracting single LAB channel
This is the list I get for "-list channel":
The list is a bit weird. For example, it has "Saturation" (which would be for colorspace HSL etc) but not "Chroma" (for HCL). These always refer to specific position of the channels, so for example you could refer to Cyan, Magenta and Yellow channels even when the colorspace has Red, Green and Blue channels.
In other words, "-channel Red" and "-channel Cyan" always refer to the first channel, whether the colorspace is RGB, CMY, Lab or anything else.
Personally, I always use R, G and B (and A for Alpha), instead of any of the others. B stands for Blue, the third channel, not for Brightness or the b* channel of L*a*b*, although those channels by good fortune happen to be in the third position.
The system does cause confusion. I'd be happier if we could use numbers: 0, 1, 2 or whatever.
Code: Select all
A
All
Alpha
B
Black
Blue
C
Cyan
Default
G
Gray
Green
H
Hue
Index
K
L
Lightness
Luminance
Magenta
Matte
M
O
Opacity
Red
R
Saturation
S
Sync
Y
Yellow
In other words, "-channel Red" and "-channel Cyan" always refer to the first channel, whether the colorspace is RGB, CMY, Lab or anything else.
Personally, I always use R, G and B (and A for Alpha), instead of any of the others. B stands for Blue, the third channel, not for Brightness or the b* channel of L*a*b*, although those channels by good fortune happen to be in the third position.
The system does cause confusion. I'd be happier if we could use numbers: 0, 1, 2 or whatever.
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: bug when extracting single LAB channel
Yes, I would agree, especially for IM 7 where more than 5 channels are possible. That would make it easier for all colorspaces, also.The system does cause confusion. I'd be happier if we could use numbers: 0, 1, 2 or whatever.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: bug when extracting single LAB channel
You can specify numbers in later versions of ImageMagick. For IM 6, 0-5. For IM 7, 0-31