This page describes the image composition methods that define how two images are merged together during operations combining a 'source' (overlay) image with a 'destination' (background) image. For the Command Line API, the method is normally selected with the -compose setting, and applied by operators such as -composite, -layers, -flatten, -mosaic, -draw, and others.
Most alpha-blending operators and lighting modes follow the W3C SVG Compositing Specification, extending SVG 1.1 and 1.2 with full Porter–Duff alpha operators. ImageMagick implements identical mathematical results to SVG, PDF, and modern graphics libraries.
Composition terminology uses abstract values like QuantumRange and opacity ranging from opaque to transparent. Method names are case-insensitive and allow _ or - separators (e.g., Dst-Over equals dstover).
The following twelve classical Porter–Duff operators defined by the SVG 1.2 standard merge two images purely according to transparency.
| Method | Description |
|---|---|
clear |
Both color and alpha of the destination are cleared. Neither source nor destination is used as input (except meta-data). Result is fully transparent. |
src |
The source is copied to the destination, completely replacing it. Un-overlaid areas are cleared to transparency. |
dst |
The destination is left untouched. Source image is ignored (no-op for color data, useful for testing). |
src-over |
Source composited over destination. This is the default alpha-blending method when unspecified. |
dst-over |
Destination composited over source. Places source under destination; ideal for backgrounds or drop shadows. |
src-in |
Part of source inside destination shape replaces destination. Everything outside is cleared. |
dst-in |
Part of destination inside source shape replaces destination. Convenient for alpha masks. |
src-out |
Part of source outside destination shape replaces destination. Overlapping region cleared. |
dst-out |
Part of destination outside source shape replaces destination ("punched out" hole). |
src-atop |
Part of source inside destination shape is composited onto destination, keeping destination shape/alpha. |
dst-atop |
Part of destination inside source shape replaces destination. Result keeps source shape and destination colors. |
xor |
Combines parts of source and destination outside their overlap. Overlapping area is cleared. |
Shorthand notes: Src- prefixes can be omitted (e.g., Over, In, Out, ATop). Un-overlaid clearing behavior for Clear, Src, Src-In, Dst-In, Src-Out, and Dst-ATop can be disabled via -define compose:outside-overlay=false.
$ magick rose: label.png -gravity center -compose Over -composite result.png
$ magick label_white.png label_black.png -geometry +5+5 -compose Dst-Over -composite shadow.png
These methods combine color channels using arithmetic or comparison formulas rather than transparency alone. Includes SVG 1.2 separable blend modes like Multiply, Screen, Darken, Lighten, Difference, and Exclusion.
| Method | Description |
|---|---|
multiply |
Source multiplied by destination. Result is at least as dark as inputs. Black produces black; white leaves color unchanged. |
divide |
Divides pixel values of one input image by another channel by channel for normalization or contrast. |
screen |
Complements multiplied, then complemented again. Result is at least as light as inputs (mathematical opposite of multiply). |
bumpmap |
Source intensity multiplied with destination color using single luminance to shade destination (great for embossed textures). |
divide-dst |
True mathematical division of destination by source (Dc / Sc). Equal colors yield white (1.0). Efficient built-in background removal. |
divide-src |
Reverse of divide-dst: divides source by destination (Sc / Dc). |
plus |
Source added to destination with alpha channels added. Exceeding QuantumRange is clamped to white. |
add |
Like plus, but exceeding QuantumRange wraps around using modulus arithmetic. Transparent areas remain transparent. |
minus |
Subtracts source color from destination (Dc - Sc) with negative results clamped to black. |
minus-src |
Reverse of minus-dst: subtracts destination from source (Sc - Dc). |
subtract |
Subtracts source from destination, wrapping negative results with modulus arithmetic rather than clamping. |
difference |
Absolute difference between colors. White inverts destination; black produces no change; identical colors produce black. |
exclusion |
Similar to difference but lower in contrast. |
darken |
Selects darker of destination and source channel-by-channel. |
lighten |
Selects lighter of destination and source channel-by-channel. |
darken-intensity |
Compares overall luminance rather than channels; keeps whole pixel that is darker, preserving hue. |
lighten-intensity |
Compares overall luminance; keeps whole pixel that is lighter. |
negate |
Opposite of difference; intermediate colors become brighter instead of darker. |
reflect |
Related to color-dodge for adding shiny objects or bright light zones. |
freeze |
Inverts base and blend colors, applies reflect, and inverts result to deepen shadows. |
stamp |
Similar to average mode for relief/bump textures while retaining mid-tones. |
interpolate |
Combines multiply and screen using smooth cosine interpolation (gentle S-curve). |
Use -define compose:sync=false to apply math composition on individual channel bases (including alpha) without alpha composition interference.
$ magick scan.png \( +clone -blur 0x20 \) -compose Divide_Src -composite flattened.png
Light, dodge, and burn blend modes standard to SVG 1.2 and popular image editors.
| Method | Description |
|---|---|
linear-dodge |
Equivalent to plus (adds channels without adding alpha), using normal Over alpha blending. |
linear-burn |
Additive counterpart to screen; subtracts one (full white) from result, darkening image. |
color-dodge |
Brightens destination to reflect source by dividing destination by inverse source. |
color-burn |
Darkens destination to reflect source (inverse of color-dodge). |
overlay |
Multiplies or screens colors based on destination color, preserving highlights and shadows. |
hard-light |
Multiplies or screens based on source color value (<0.5 darkens like multiply, >0.5 lightens like screen). |
hard-mix |
Adds source and destination values then thresholds result to pure black or white per channel. |
linear-light |
Like hard-light, but using linear-dodge and linear-burn for strong contrast impact. |
soft-burn |
Combination of color-burn and inverse color-dodge; lightens base slightly while burning dark blend colors. |
soft-dodge |
Combination of color-dodge and inverse color-burn; darkens base slightly while dodging bright blend colors. |
soft-light |
SVG 1.2 soft-light mode; darkens or lightens depending on source value (<0.5 darkens, >0.5 lightens) without pure black/white. |
pegtop-light |
Computed with a continuous mathematical formula to avoid soft-light's discontinuity at 0.5. |
vivid-light |
Modified linear-light designed to preserve strong primary and secondary colors. |
pin-light |
Simulates pinhole light source using sharp linear shadings. |
$ magick photo.png texture.png -compose Soft-Light -composite result.png
Transfer individual channels or HSL components (hue, saturation, luminosity) without arithmetical blending.
| Method | Description |
|---|---|
copy |
Equivalent to Src composition without clearing un-overlaid destination parts. |
copy-<channel> |
Copies specified channel (Red, Green, Blue, Cyan, Magenta, Yellow, Black, Alpha) from source to destination. |
hue |
Replaces destination hue with source hue while keeping saturation and luminosity. |
saturate |
Replaces destination saturation with source saturation while keeping hue and luminosity. |
luminize |
Replaces destination luminosity with source luminosity while keeping hue and saturation. |
colorize |
Replaces destination hue and saturation with source while keeping luminosity (ideal for tinting grayscale images). |
$ magick portrait.png xc:steelblue -compose Colorize -composite tinted.png
| Method | Description |
|---|---|
no |
True no-op indicating no composition should be performed. |
change-mask |
Replaces destination pixels similar to source pixel (within -fuzz factor) with transparency. |
stereo |
Creates stereo anaglyph taking red channel from source and green/blue from destination. |
These methods require extra numerical arguments, passed via -define compose:args=... in the magick command.
$ magick ... -compose blend -define compose:args=50,50 -composite ...
| Method | Description |
|---|---|
dissolve |
Arguments: src_percent[x dst_percent]. Dissolves source image by percentage before overlaying. |
blend |
Arguments: src_percent[x dst_percent]. Averages images together according to percentages and transparency. |
mathematics |
Arguments: A, B, C, D. Merges via formula A*Sc*Dc + B*Sc + C*Dc + D. |
modulate |
Arguments: brightness[x saturation]. Takes grayscale image/mask to modify destination brightness/saturation. |
displace |
Arguments: X-scale[x Y-scale][!][%]. Uses overlay as relative displacement map (lens distortion). |
distort |
Arguments: X-scale[x Y-scale[+ X-center+ Y-center]]][!][%]. Uses absolute coordinates relative to overlay center. |
blur |
Arguments: Width[xHeight[+Angle][+Angle2]]. Variable-blur mapping composition via EWA ellipse. |
seamless-blend |
Arguments: max-iterationsx distortion. Seamlessly inserts overlay onto background using a mask (best with HDRI). |
saliency-blend |
Arguments: max-iterationsx distortion. Merges images based on which has most detail at each pixel (requires mask). |
To print a complete list of all available compose operators supported by your specific build, run magick -list compose.