Learn ImageMagick - Montage, Animate & Display
Episode 6 of 23

Learn ImageMagick - Montage, Animate & Display

In this episode you'll arrange many images into a single thumbnail grid with magick montage, play GIF animations with magick animate, and inspect images interactively with magick display before publishing.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In episode 5 you mastered color, channels, and alpha — from colorspace conversion to managing per-channel transparency. Now it's time to move from "single image" work toward "many images": arranging dozens of thumbnails on one canvas, playing GIF animations straight from the terminal, and inspecting the results interactively before publishing.

The three commands we'll dissect — magick montage, magick animate, and magick display — are the presentation side of ImageMagick. Montage answers the question "how do I show many images at once", animate brings frames to life, and display gives you a second pair of eyes to inspect details.

Why Montage

Imagine you manage a product catalog with 200 photos and must show them all on a single report page. Pasting them one by one into a graphics editor takes hours. magick montage does the same job in one line: reads many images, resizes them uniformly, then arranges them in a neat grid. It's the default tool for creating contact sheets, catalogs, and render previews.

Creating a Thumbnail Grid with Montage

The most basic formulation: list all input files, then -tile determines the number of grid columns and rows.

montage-grid.sh
magick montage foto-1.jpg foto-2.jpg foto-3.jpg foto-4.jpg \
  -tile 2x2 -geometry +2+2 montage.png

-tile 2x2 forces a grid of two columns and two rows. Without -tile, montage guesses the number of columns from the number of images. -geometry +2+2 adds a two-pixel gap between cells; numbers without units mean spacing, not size.

Many inputs are easy to feed in via glob:

montage-glob.sh
magick montage foto-*.jpg -tile 3x4 -geometry +4+4 montage.png

With foto-*.jpg, montage reads all files matching the pattern. The input order follows the shell's sort order, so consistent file names — for example foto-01.jpg through foto-12.jpg — produce a predictable grid.

Controlling Size and Spacing with -geometry

-geometry can also limit the size of each thumbnail before layout. The format WxH+gapX+gapY means "resize to fit inside a WxH box, then add spacing".

montage-geometry.sh
magick montage foto-*.jpg -tile 4x4 \
  -geometry 160x120+3+3 -background '#f0f0f0' montage.png

Each photo is scaled to fit inside a 160x120 pixel box without breaking the aspect ratio. -background fills the empty space around each thumbnail — a small element that makes the grid look professional rather than just a stack of images. You can swap -tile and -geometry to try different grid densities without touching the original files.

Labels and Frames

Two favorite visual refinements: -label writes a caption below each cell, and -frame adds an ornamental border around it.

montage-label-frame.sh
magick montage foto-*.jpg -tile 4x3 -geometry 160x120+3+3 \
  -label '%f' -frame 6 -bordercolor '#999999' montage.png

-label '%f' uses the %f escape format, filled with the original file name — useful for visual audits, because you immediately know which cell comes from which file. -frame 6 gives a 6-pixel beveled frame, while -bordercolor colors that frame. Labels become the differentiator between image versions that look nearly identical.

Adding Depth with Shadows

A plain grid looks flat. Adding a subtle shadow under each thumbnail makes the montage look like a stack of cards — a small element that leaves a professional impression:

montage-shadow.sh
magick montage foto-*.jpg -tile 4x4 -geometry 160x120+4+4 \
  -shadow -background white montage-shadow.png

-shadow adds a drop shadow around each cell, and -background becomes the base canvas color the shadow falls onto. Shadows also help the eye separate one image from another — useful when the grid contains photos with similar edge colors.

Contact Sheets to PDF

Montage is not limited to PNG: because ImageMagick determines the format from the output extension, you can write the grid directly to a multi-page PDF. This is a practical way to produce contact sheets you can send to a client or print.

montage-pdf.sh
magick montage foto-*.jpg -tile 4x4 \
  -geometry 200x150+4+4 -label '%f' contact-sheet.pdf

One command produces a PDF document containing a neat grid. When the image collection grows, the next pages are added automatically. This multi-page behavior is what we'll dissect more deeply in episode 9 when we discuss image lists and multi-frame.

Animate: Playing GIFs

Montage arranges static images; magick animate plays framed images. The analogy is turning a flipbook on: each GIF frame is one page, and animate flips them at a certain speed.

animate-gif.sh
magick animate animasi.gif

A window will open and play the animation according to the -delay stored inside the GIF. The basic interactions: + and - speed up or slow down, space pauses, and q (or Esc) closes the window. Speed can be forced without modifying the file:

animate-delay.sh
magick animate -delay 20 animasi.gif

The -delay value uses units of 1/100 second, so 20 means 200 milliseconds per frame. This trick is ideal for inspecting an animation before saving it — you don't need to create a new file just to see the result.

Note

Both magick animate and magick display require a graphical environment — X11 on Linux or a desktop terminal session. On a headless server without a display, both are useless; use conversion to video or frame extraction instead.

Display: Interactive Viewer

magick display is an interactive image viewer: you can open a single file, zoom into a specific area, and navigate between images in one session.

display-gambar.sh
magick display foto-01.jpg

Once the window opens, clicking zooms into the clicked area, right-click shows a context menu, the arrow keys move to the next image, and q closes it. This command is most useful for quick visual inspection before an image enters the production pipeline — for example making sure there are no compression artifacts after the resize from episode 4.

Closing

In episode 6 you've arranged many images into a thumbnail grid with magick montage — including -tile for the grid shape, -geometry for size and spacing, -label and -frame for captions and frames, plus PDF output as a contact sheet — then brought them to life with magick animate and inspected them interactively with magick display.

The takeaway: montage is the bridge between many files and one shareable artifact. When you have to review 200 images, a neat grid is far faster to scan than opening files one by one.

In the next episode 7 we stop arranging images and start drawing on top of them: shapes, lines, and text via -draw, -annotate, up to watermarking. See you then!

Learn ImageMagick - Montage, Animate & Display | Learn ImageMagick