Explain Masking

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.

Explain Masking

Post by walzmyn »

Can someone please explain to me how to use the masking technique? I am posting in the PerlMagick board because that's the medium I'm usually using, but I'd appreciate help via CLI or Perl.
I have read everything on the website and looked though all the examples and melted on Google server looking for information and still just do not understand how this mask thing works.

Here's what I would eventually like to do. (Well, the first of many) Annotate an image, then use the text from that image as a mask, composite that text onto a second image and use it to cut a transparent hole in the second image.

At least I think using a mask is the proper way to do this. Right now I'm making the text white and compositing it onto an image I know has no white, then turning everything white transparent. This has it's issues though and I'd prefer to do it "right".

Thanks in advance.

Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Explain Masking

Post by el_supremo »

This illustrates how to use a mask from the command line. You can change the mask to be your text.
http://www.imagemagick.org/Usage/channe ... ed_compose

This is my translation of the above command line into C which might help you with writing it in Perl.
http://members.shaw.ca/el.supremo/Magic ... yclops.htm

Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.