← 返回命令列表

Linux command

composite 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Overlay one image

composite [overlay.png] [background.png] [output.png]

Place overlay at a specific position

composite -geometry +[100]+[50] [overlay.png] [background.png] [output.png]

Blend images

composite -blend [50]% [image1.png] [image2.png] [output.png]

Use a mask

composite [overlay.png] [background.png] [mask.png] [output.png]

Apply multiply

composite -compose multiply [overlay.png] [background.png] [output.png]

Dissolve overlay

composite -dissolve [75]% [overlay.png] [background.png] [output.png]

Center the overlay

composite -gravity center [overlay.png] [background.png] [output.png]

说明

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.

参数

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

FAQ

What is the composite command used for?

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.

How do I run a basic composite example?

Run `composite [overlay.png] [background.png] [output.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -compose _METHOD_ do in composite?

Compositing operator: over, multiply, screen, overlay, darken, lighten, etc.