LinuxCommandLibrary

composite

combine images with blending and compositing operations

TLDR

Overlay one image on top of another

$ composite [overlay.png] [background.png] [output.png]
copy
Place overlay at a specific position
$ composite -geometry +[100]+[50] [overlay.png] [background.png] [output.png]
copy
Blend images with transparency
$ composite -blend [50]% [image1.png] [image2.png] [output.png]
copy
Use a mask for compositing
$ composite [overlay.png] [background.png] [mask.png] [output.png]
copy
Apply multiply blend mode
$ composite -compose multiply [overlay.png] [background.png] [output.png]
copy
Dissolve overlay into background
$ composite -dissolve [75]% [overlay.png] [background.png] [output.png]
copy
Center the overlay on background
$ composite -gravity center [overlay.png] [background.png] [output.png]
copy

SYNOPSIS

composite [options] overlay background [mask] output

DESCRIPTION

composite is the ImageMagick tool for combining two or more images into a single image. It provides extensive compositing operations similar to layer blending in graphics editors, enabling complex image manipulation from the command line.
The overlay image is placed over the background image according to the specified compose method and positioning. An optional mask image can control which parts of the overlay affect the final result. Common operations include watermarking, creating image collages, and applying visual effects.
The gravity option provides convenient positioning (center, corners, edges) while geometry allows pixel-precise placement. Blend modes like multiply, screen, and overlay follow standard graphics compositing mathematics.

PARAMETERS

-compose METHOD

Compositing operator: over, multiply, screen, overlay, darken, lighten, etc.
-geometry GEOMETRY
Position offset for overlay (+X+Y format).
-gravity TYPE
Anchor point: center, north, south, east, west, northeast, etc.
-blend GEOMETRY
Blend percentages for source and destination.
-dissolve PERCENT
Dissolve overlay into background at specified percentage.
-watermark BRIGHTNESS
Apply overlay as watermark with given brightness.
-tile
Tile the overlay image across the background.
-stegano OFFSET
Hide the overlay within the background image (steganography).
-stereo OFFSET
Create a stereo anaglyph image.
-density VALUE
Set image resolution.
-quality VALUE
Output compression quality (0-100).

CAVEATS

Image order matters: overlay comes before background in the command. The output inherits dimensions from the background image by default. Alpha channels affect compositing; use -alpha options for explicit control. For batch operations, consider mogrify or magick for better performance.

HISTORY

composite is part of ImageMagick, originally created by John Cristy in 1990. It has evolved to support dozens of compositing operators, matching capabilities found in professional image editing software. The tool remains essential for scriptable image manipulation.

SEE ALSO

convert(1), montage(1), mogrify(1), magick(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community