v7 -separate and alpha

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Posts: 10031
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

v7 -separate and alpha

Post by snibgo » 2016-05-16T22:27:44-07:00

I suppose this is a feature of v7, rather than a bug. If so, perhaps it could be mentioned in the v7 porting guide. (It took me two days to pin down.)

Suppose we have an image with RGBA channels, and we "-separate".

The default output under v6 is three grayscale images, for each of R,G and B.

The default output under v7 is different. We get four grayscale images, for each of R,G,B and A.

For v6 or v7, we can use "-channel RGB" or "-channel RGBA" to deliberately exclude or include alpha.

Of course, when the v7 input file is grayscale, the default is to create one or two outputs, depending on whether the input has alpha.

When porting v6 scripts, to get the same three outputs, it seems generally sensible to replace ...

Code: Select all

... with ...

Code: Select all

-colorspace sRGB -channel RGB -separate
snibgo's IM pages: im.snibgo.com

Post Reply