superposition of image

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
MOUS

superposition of image

Post by MOUS »

Hello !

( sorry i'am french :lol: )



how superimposed two photograph in Linux OS? ( using just bash terminal )

example :

photo in
Image
Image

the pix for paste ( 75% of opacity for the paste )
Image

and the final
Image
Image



how to do that ?

Thanx :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: superposition of image

Post by fmw42 »

Try this for an example with 50% opacity (where opacity=100 - transparency), which overlays the rose: image onto the logo: image.

convert logo: \
\( rose: -alpha on -channel A -evaluate set 50% \) \
-geometry +50+50 -composite logo_rose.png


In general:
convert backgroundimage \
\( overlayimage -alpha on -channel A -evaluate set OPACITY% \) \
-geometry +XLOCATION+YLOCATION -composite resultimage

The first image is the background, the second image is to be overlaid. The second line turns on the alpha channel and sets its opacity. The third line identifies where to overlay the second image on the first image and does the composite.

If you want to put the overlayimage in two (or more) places, then do as follows:

convert backgroundimage \
\( overlayimage -alpha on -channel A -evaluate set OPACITY% \) \
-geometry +XLOCATION1+YLOCATION1 -composite \
\( overlayimage -alpha on -channel A -evaluate set OPACITY% \) \
-geometry +XLOCATION2+YLOCATION2 -composite \
resultimage


You can also use composite and dissolve with two images at a time. This is a little simpler as you don't have to formally create the alpha channel.

composite -dissolve OPACITY% -geometry +XLOCATION+YLOCATION \
overlayimage backgroundimage -matte resultimage

So if you want to put it in two places, for example, you need two command lines.

composite -dissolve 50% -geometry +50+50 rose: logo: -matte logo_rose.png
composite -dissolve 50% -geometry +150+150 rose: logo_rose.png -matte logo_rose.png

or you can combine them into one command as follows:

composite -dissolve 50% -geometry +50+50 rose: logo: -matte miff:- | \
composite -dissolve 50% -geometry +150+150 rose: - -matte logo_rose.png


see
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/Usage/layers/
MOUS

Re: superposition of image

Post by MOUS »

ok

this command of my utilitie ;)

$ composite -dissolve 25 -gravity south tampon.png in.jpg out.jpg


thanx ! :)
Post Reply