Page 1 of 1

Masks, Mattes, Transparencies and Keys

Posted: 2007-08-05T13:49:01-07:00
by mantlepro
To the ImageMagick wizards and problem solvers:

I need help extracting the mask from a tga file and have tried all of the following before posting here:

convert file.tga -channel matte -separate +channel -negate file_1.tga
convert file.tga -channel matte -negate -separate file_2.tga
convert file.tga -fx 'A' +matte file_3.tga
I also tried the colorize method.

None of these produce the true alpha channel by itself (as I can get using Final Cut Pro's extract matte tool so I know it's there). What am I missing here? Is there a problem with the image not getting processed in true RGBA space (a problem seen in another post)?

This is for a video playback system at our TV station. Our sequencer plays the animation on one channel while the other channel plays the black & white traveling matte so we can key the animation over another video source. I need the one tga file split into two files: the animation file and the matte file.

Any help would be appreciated! Thanks!

Re: Masks, Mattes, Transparencies and Keys

Posted: 2007-08-05T16:17:42-07:00
by el_supremo
Using "matte" as a channel will be interpreted as Magenta! You should use "alpha" and then your first command should do what you want.

Pete

Re: Masks, Mattes, Transparencies and Keys

Posted: 2007-08-06T23:01:01-07:00
by mantlepro
Here's the weirdness... the command works with png files, but doesn't work with tga files. It seems like IM flattens the tga to straight RGB before I get a chance to work with the alpha channel.

With this in mind, I tried an experiment:
Using Apple's Preview (which supports Alpha channels), I exported a png from the original tga that preserved the transparencies and then ran the following ImageMagick command:

Code: Select all

convert file.png -channel alpha -negate -separate out.png
It worked on the png file but not the tga.

I wish IM could handle TARGA alpha channels so I can get my project done easily and simply. Any other thoughts or solutions?

Re: Masks, Mattes, Transparencies and Keys

Posted: 2007-08-07T09:11:38-07:00
by el_supremo
Can you post a link to an example TGA file?

Pete

Re: Masks, Mattes, Transparencies and Keys

Posted: 2007-08-12T22:50:48-07:00
by anthony
el_supremo wrote:Using "matte" as a channel will be interpreted as Magenta! You should use "alpha" and then your first command should do what you want.
That shouldn't ne happening. The 'matte' should match on the the specific
channel strings, as given by

Code: Select all

   convert -list channel
It only trys to interprete it usiung characters after exhausting those posibilities, at which point 'm' is magenta, 'a' is alpha/matte.

Note "Magenta" is a short cut for the second color channel, whcih is also exactly the same as "green" is the second is green or magenta depend on the 'colorspace' of the image stored in memory.

See ColorSpace
http://www.imagemagick.org/Usage/basics/#colorspace