Example Usage • Option Summary
Use the composite program to overlap one image over another. See Command Line Processing for advice on how to structure your composite command or see below for example usages of the command.
Example Usage
We list a few examples of the composite command here to illustrate its usefulness and ease of use. To get started, lets overlay a smiley face over a rose:
$ magick composite -gravity center smile.gif rose: rose-over.png
You can create three-dimensional effect with the Atop:
$ magick -size 70x70 canvas:none -fill red -draw 'circle 35,35 10,30' red-circle.png $ magick -size 70x70 canvas:none -draw "circle 35,35 35,20" -channel RGB -negate -channel A -gaussian-blur 0x8 white-highlight.png $ magick composite -compose atop -geometry -13-17 white-highlight.png red-circle.png red-ball.png
Or suppose you want to blend a bear into a stream seamlessly. Try this command:
$ magick -verbose stream.jpg bear.jpg bear_mask.png -define compose:args=400x0.0002+100 \ -compose seamless-blend -geometry +30+30 -composite bear-in-stream.png
The mask marks the area around the bear to blend. Seamless blending is an iterative process. Here, we limit the iterations to 400 or less if the blending converges (residual has an RMSE of less than 0.0002). The residual value (RMSE) is printed every 100 iterations. Note, seamless blending works most effectively when the HDRI feature is enabled.
$ magick -verbose stream.jpg \( bear.jpg -read-mask only_bear.png \) bear_mask.png \ -define compose:args=400x0.0002+100 -compose seamless-blend -geometry +30+30 -composite \ bear-in-stream.png
Here we create read mask that marks the foreground object from its background. No blending is applied to the foreground object, just its surroundings. The read-mask preserves the colors of the bear and prevents them from lightening as in the first example. Note that read-masks must be black on white background as opposed to normal masks, which are white on black background.
You can find additional examples of using composite in Examples of ImageMagick Usage. You can find out more about them and the mathematics by looking at SVG Alpha Compositing
Option Summary
The composite command recognizes these options. Click on an option to get more details about how that option works.


