ImageMagick v6 Examples --
Compose Tables

ImageMagick Examples Preface and Index

Compose Tables

The following tables of most of the IM compose methods with various shapes and gradients. They form a summary of these important alpha compositing methods, and was vital in helping me figure out exactly what each composition method did and for what purpose they can be used.

The command that is being run is generally...

  convert {Dst} {Src} \
          -gravity center -compose {method} -composite \

A shell script "compose_table" also generates and displays various tables (with various options) of compose methods, and was developed later.

For these first set of tables with I am using two images which are simular to the test images used in the documentation for SVG Alpha Compositing. They are perfect for demonstrating the 12 'Duff-Porter' compose operators. They are trianglular images containng no semi-transparent pixels (only transparent and opaque colors).

However I have found that using overlapping circles, such as typically used in 'Ven Disgrams' for set theory to be more useful.

As some of compositing operators will modify the whole background (destination) image, including outside the overlaid area, or even if the source is completely transparent. Because of this I have increased the size of the background (destination) image slightly, and added a "-gravity center" setting.

Operators that clear the area outside the overlayed region are: Clear, Src, In, Dst_In, Out, and Dst_Atop. However if you do not want this you can use the operational setting "-define compose:outside-overlay=false" to turn off this aspect of Duff-Porter Composition.

[IM Output] [IM Output]

However while the Duff-Porter methods are usful for basic image overlays, Their are a set of math methods that are much more useful with image masks.

To demostrate I created some black and white images of circles which overlap, so you can see the results.

[IM Output] [IM Output]

Note the 'edge' effects that result in some of the above images. These are caused by the edges of the circles being some shade of gray (anti-aliasing), rather than purely black or white. They appear in 'ModulusAdd' and 'ModulusSubtract' as these are 'modulus wrapped'. (See the specific section on Add and Subtract, mathematical composition for more details.

Gradients make the best demonstration of the mathematical methods as well as "Channel Coping" and "Color Manupliation" alpha blending methods.

[IM Output]
[IM Output] [IM Output]
[IM Output] [IM Output]

Created: 5 January 2004
Updated: 11 July 2009
Author: Anthony Thyssen, <>
Examples Generated with: [version image]