brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: montage makes a contact sheet out of a folder of images

Images
~/tips/tip-magick-montage-contact-sheet

montage *.jpg -tile 4x -geometry 300x300+4+4 sheet.jpg

Combines many images into one grid image with a single ImageMagick command.

Before I send someone twenty screenshots, I’d rather send one picture with all of them. ImageMagick’s montage tool builds that overview in one line.

montage *.jpg -tile 4x -geometry 300x300+4+4 sheet.jpg

Every image becomes a tile that fits inside 300 by 300 pixels, with 4 pixels of border on each side. -tile 4x puts four tiles per row and lets the number of rows follow. Use 3x2 to fix both.

The last name on the line is the output file. Because the pattern *.jpg is expanded by the shell, a leftover sheet.jpg from an earlier run gets picked up as an input the next time. Write the sheet to another folder or name it differently.

With -label '%f' placed before the images, each tile gets its filename underneath, which turns the sheet into a proper index. Add -pointsize if the text comes out small.

On ImageMagick 7 the commands also work as magick montage. A montage of large photos eats memory, since every input is loaded, so resize first or lower the tile size for big folders.

The tool has a few more decorations. -title puts a heading on the whole sheet, -shadow adds a shadow under each tile and -frame draws an ornamental border around it. -background sets the colour behind the tiles. Run montage -help to see the full list for your version.

Further reading: ImageMagick montage

More Images tips magick mogrify -path small -resize "1600×1600>" *.jpg All Images tips (2) All topics

Link