Masks, Mattes, Transparencies and Keys

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
mantlepro

Masks, Mattes, Transparencies and Keys

Post 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!
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Masks, Mattes, Transparencies and Keys

Post 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
mantlepro

Re: Masks, Mattes, Transparencies and Keys

Post 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?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Masks, Mattes, Transparencies and Keys

Post by el_supremo »

Can you post a link to an example TGA file?

Pete
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Masks, Mattes, Transparencies and Keys

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply