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' -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.

Option | Description
--- | ---
-affine matrix | affine transform matrix
-alpha | on, activate, off, deactivate, set, opaque, copy", transparent, extract, background, or shape the alpha channel
-authenticate value | decrypt image with this password
-blend geometry | blend images
-blue-primary point | chromaticity blue primary point
-border geometry | surround image with a border of color
-bordercolor color | border color
-channel type | apply option to select image channels
-colors value | preferred number of colors in the image
-colorspace type | set image colorspace
-comment string | annotate image with comment
-compose operator | set image composite operator
-compress type | image compression type
-debug events | display copious debugging information
-decipher filename | convert cipher pixels to plain
-define format:option | define one or more image format options
-density geometry | horizontal and vertical density of the image
-depth value | image depth
-displace geometry | shift image pixels defined by a displacement map
-dissolve value | dissolve the two images a given percent
-dither method | apply error diffusion to image
-encipher filename | convert plain pixels to cipher pixels
-encoding type | text encoding type
-endian type | endianness (MSB or LSB) of the image
-extract geometry | extract area from image
-filter type | use this filter when resizing an image
-font name | render text with this font
-geometry geometry | preferred size or location of the image
-gravity type | horizontal and vertical text placement
-green-primary point | chromaticity green primary point
-help | print program options
-identify | identify the format and characteristics of the image
-interlace type | type of image interlacing scheme
-interpolate method | pixel color interpolation method
-label string | assign a label to an image
-level value | adjust the level of image contrast
-limit type value | pixel cache resource limit
-log format | format of debugging information
-monitor | monitor progress
-monochrome | transform image to black and white
-negate | replace each pixel with its complementary color
-page geometry | size and location of an image canvas (setting)
-pointsize value | font point size
-profile filename | add, delete, or apply an image profile
-quality value | JPEG/MIFF/PNG compression level
-quantize colorspace | reduce image colors in this colorspace
-quiet | suppress all warning messages
-red-primary point | chromaticity red primary point
-regard-warnings | pay attention to warning messages.
-respect-parentheses | settings remain in effect until parenthesis boundary.
-rotate degrees | apply Paeth rotation to the image
-sampling-factor geometry | horizontal and vertical sampling factor
-scene value | image scene number
-seed value | seed a new sequence of pseudo-random numbers
-set attribute value | set an image attribute
-sharpen geometry | sharpen the image
-shave geometry | shave pixels from the image edges
-size geometry | width and height of image
-stegano offset | hide watermark within an image
-stereo geometry | combine two image to create a stereo anaglyph
-strip | strip image of all profiles and comments
-swap indexes | swap two images in the image sequence
-synchronize | synchronize image to storage device
-taint | mark the image as modified
-thumbnail geometry | create a thumbnail of the image
-tile | repeat composite operation across and down image
-transform | affine transform image
-transparent-color color | transparent color
-treedepth value | color tree depth
-type type | image type
-units type | the units of image resolution
-unsharp geometry | sharpen the image
-verbose | print detailed information about the image
-version | print version information
-virtual-pixel method | access method for pixels outside the boundaries of the image
-watermark geometry | percent brightness and saturation of a watermark
-white-point point | chromaticity white point
-white-threshold value | force all pixels above the threshold into white
-write filename | write images to this file