LinuxCommandLibrary

magick-montage

Create a montage of multiple images

TLDR

Tile images into a grid, automatically resizing images larger than the grid cell size

$ magick montage [path/to/image1.jpg path/to/image2.jpg ...] [path/to/montage.jpg]
copy

Tile images into a grid, automatically calculating the grid cell size from the largest image
$ magick montage [path/to/image1.jpg path/to/image2.jpg ...] -geometry [+0+0] [path/to/montage.jpg]
copy

Specify the grid cell size and resize images to fit it before tiling
$ magick montage [path/to/image1.jpg path/to/image2.jpg ...] -geometry [640x480+0+0] [path/to/montage.jpg]
copy

Limit the number of rows and columns in the grid, causing input images to overflow into multiple output montages
$ magick montage [path/to/image1.jpg path/to/image2.jpg ...] -geometry [+0+0] -tile [2x3] [montage_%d.jpg]
copy

Resize and crop images to fill their grid cells before tiling
$ magick montage [path/to/image1.jpg path/to/image2.jpg ...] -geometry [+0+0] -resize [640x480^] -gravity [center] -crop [640x480+0+0] [path/to/montage.jpg]
copy

SYNOPSIS

magick montage [options] input_image [input_image...] output_image

Examples:
magick montage *.jpg -geometry 100x100+5+5 -tile 5x4 output.jpg
magick montage -label %f -frame 5 -background gray images/*.png montage.gif

PARAMETERS

-geometry WxH{+-}X{+-}Y
    Sets the preferred size and offset for each image in the montage. For example, 120x120+10+10 for 120x120 pixel images with a 10-pixel border.

-tile colsxrows
    Defines the column and row geometry for the montage grid. For instance, 5x4 creates a grid with 5 columns and 4 rows.

-label string
    Applies a text label to each image. Common format specifiers like %f (filename) can be used. For example, -label '%f'.

-frame WxH{+-}X{+-}Y
    Adds a decorative frame around each image. The geometry defines frame width, height, and bevel.

-background color
    Specifies the background color used behind the images and for empty tile spaces. E.g., 'white', '#RRGGBB'.

-bordercolor color
    Sets the color of the border around each image (if -borderwidth is used). Default is black.

-borderwidth pixels
    Defines the width of the border around each image in pixels. Often used with -bordercolor.

-pointsize value
    Determines the font size for image labels and the montage title.

-font name
    Specifies the font family to use for labels and the montage title. E.g., 'Arial', 'Times-Roman'.

-gravity cardinal-direction
    Controls the position of the label within its image tile (e.g., North, South, Center).

-title string
    Adds an overall title to the entire montage.

-shadow
    Applies a simulated drop shadow effect to each image in the montage.

-mode type
    Sets the montage layout mode. 'frame' (default), 'concatenate' (joins images without spacing), or 'unframe'.

DESCRIPTION

magick-montage is a powerful command-line utility from the ImageMagick suite designed to assemble multiple input images into a single composite image, often arranged in a grid or tiled layout. It's ideal for creating contact sheets, photo albums, or visual summaries of image collections. Users can control various aspects of the montage, including the size and spacing of individual images, borders, frames, labels, and the overall layout. This flexibility makes it an invaluable tool for photographers, web developers, and anyone needing to present multiple images concisely and aesthetically. It supports a wide range of image formats for both input and output.

CAVEATS

magick-montage can be resource-intensive, especially with a large number of high-resolution input images, potentially consuming significant memory and CPU. The exact behavior of options can sometimes be complex, requiring experimentation to achieve desired visual results. Ensuring ImageMagick is compiled with necessary delegates (libraries for specific image formats) is crucial for full functionality.

HISTORY

montage has been a core utility within the ImageMagick suite since its early development. ImageMagick itself originated in 1987, initially developed by John Cristy at DuPont. The montage command has evolved alongside ImageMagick, gaining more features and options to support increasingly complex image compositing needs. While originally a standalone executable, in modern ImageMagick (v7+), it's typically invoked as a subcommand of the magick program, streamlining the interface for all ImageMagick operations. Its continuous development reflects the ongoing demand for powerful command-line image manipulation.

SEE ALSO

magick(1), magick-convert(1), magick-display(1), magick-identify(1), gm(1)

Copied to clipboard