LinuxCommandLibrary

composite

Combine images into one

SYNOPSIS

composite [options] foreground-image background-image output-image

PARAMETERS

-alpha <type>
    Control the alpha channel (e.g., on, off, set, extract) for transparency management.

-blend <factor>
    Specify the blending percentage (0-100) of the foreground image onto the background.

-channel <channel-type>
    Apply the composite operation to specific color channels (e.g., RGBA, Red, Blue).

-compose <operator>
    Set the composition operator (e.g., Over, Dissolve, Multiply, Screen, HardLight) to define how pixels are combined.

-dissolve <factor>
    Dissolve the foreground image into the background by a specified percentage (0-100).

-geometry <geometry>
    Define the position (e.g., +X+Y) and optional resizing (e.g., WxH) of the foreground image.

-gravity <direction>
    Set the placement reference point for the foreground image (e.g., NorthWest, Center, SouthEast).

-mask <filename>
    Use a separate image as a transparency mask for the foreground image during composition.

-matte
    Ensure an alpha channel is present in the output image, preserving transparency.

-tile
    Repeat the foreground image as a tile pattern over the entire background image.

DESCRIPTION

The composite command is a powerful utility from the ImageMagick suite, designed for combining two or more images into a single output image. It primarily takes a foreground image and composites it onto a background image using various methods, including different composition operators (e.g., Over, Multiply, Screen, Dissolve), alpha blending, and masking.

It's widely used for tasks like watermarking, adding logos, creating special effects, or merging graphical elements seamlessly. The command allows fine control over the placement, size, and transparency of the overlaid images, making it an essential tool for automated image manipulation in scripts and workflows. It supports a wide range of image formats and sophisticated blending modes.

CAVEATS

The standalone composite command is functionally superseded by the magick composite sub-command in ImageMagick 7 and newer versions. While still supported, the newer syntax offers better integration with the unified magick command-line interface.

Complex image manipulation tasks may sometimes require chaining multiple composite operations or leveraging the more general magick convert command for greater flexibility. Memory usage can become significant when processing very large images, especially with intricate operations or extensive tiling.

COLOR MANAGEMENT

ImageMagick provides full support for color management, including the use of ICC color profiles. The composite command respects and applies these profiles during operations, which is critical for maintaining color accuracy and consistency when combining images from diverse sources.

TRANSPARENCY HANDLING

The command intelligently utilizes alpha channels for transparency if present in either the foreground or background images. Users should be aware that if transparency is not desired, the alpha channel may need to be explicitly removed or flattened using other ImageMagick utilities like convert or mogrify prior to composition.

HISTORY

The composite command has been a fundamental component of the ImageMagick suite since its initial release in 1990. Developed by John Cristy and maintained by a global community, ImageMagick rapidly evolved, and composite with it, gaining new composition operators, color space support, and performance enhancements over decades.

Its long-standing presence underscores its importance in open-source image processing. Although ImageMagick 7 introduced the unified magick command, the standalone composite remains a widely recognized and stable utility for image overlay tasks.

SEE ALSO

convert(1), mogrify(1), montage(1), identify(1), display(1)

Copied to clipboard