Mask using -composite

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
sshadows

Mask using -composite

Post by sshadows »

Hi everyone !
I would like to use the masks ( like those : http://www.imagemagick.org/Usage/compose/#dstin ) with that method of composing : http://www.imagemagick.org/Usage/layers/#convert

Here is what I've tried :

Code: Select all

  convert -size 100x100 xc:skyblue \
          balloon.gif  -geometry  +5+10  -composite \
          medical.gif  -geometry +35+30  -composite \
          present.gif  -geometry +62+50  -composite \

       -compose Dst_In  -gravity center \
         present.png  rose: -alpha Set  medical.gif -composite \ 

          shading.gif  -geometry +10+55  -composite \
          compose.gif
I'm not looking for the exact results but just the way to use mask in this method of layering.
Thank you in advance !
Good Bye
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mask using -composite

Post by fmw42 »

I am not sure I follow your command, but the mask image must the 3rd of only 3 image, the first the background and the second is the overlay image.

see http://www.imagemagick.org/Usage/compose/#compose

Possibly parenthesis processing with -clone and -delete will help your command.

see http://www.imagemagick.org/Usage/basics/#image_seq
sshadows

Re: Mask using -composite

Post by sshadows »

Hi, and thanks for your answer !

Possibly parenthesis processing with -clone and -delete will help your command.
I'm not sure I really understand, could you please give me an example ?


I've tried another method but it's not working neither :

Code: Select all

             present.gif medical.gif -compose DstIn -composite \
Any idea ?

Thanks again for your help !
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mask using -composite

Post by fmw42 »

I believe your problem may be in this part of your command


-compose Dst_In -gravity center \
present.png rose: -alpha Set medical.gif -composite \


to me it looks like you are trying to merge more than 3 images: result from previous composite, present.png rose: and medical.gif.

As I said before, composite only allows you to use 3 images and the last will be the mask.

On suggestion is to use -write tmp1.png after each major part of your command (changing the number each time), so that you can review the steps you are using to see that you get the expected and correct results at each step


Further explanation of what you are trying to do might also be helpful and or an example from somewhere else.
Post Reply