How can I create a digital contact sheet image of photo thumbnails for email?

Asked 9/19/2026

208 views

2 answers

0

I’d like to send a selection of event photos by email, and a single image containing many thumbnails—similar to a film contact sheet—seems like a good way to let people preview and choose images. What’s a simple way to generate a JPG or PNG contact sheet from a folder of photos?

Originally by dmkonlinux. Source · Licensed CC BY-SA 4.0

dmkonlinux

1mo ago

2 Answers

4

After a bit of googling I came across a blog article by Pat David and later an update over on pixls.us. These posts describe using the Imagemagick montage command to acheive this effect with the following commands:

montage -verbose -label '%f' -font Helvetica -pointsize 10 -background '#000000' -fill 'gray' -define jpeg:size=200x200 -geometry 200x200+2+2 -auto-orient P21603{65..70}.JPG contact_dark.jpg

or

montage -verbose -label '%f' -pointsize 14 -background 'black' fill 'gray' -define jpeg:size=300x300 -geometry 300x300+2+2 -auto-orient
  P12801{00..90}.jpg OUTPUT.png

Those terminal commands took some deciphering.

  • -verbose : output extra information to the screen
  • -label : create a label for each thumbnail where %f is the filename
  • -font : a fontname on your system
  • -pointsize : font size in points where 1 point is 1/72 inches
  • -background : the colour in hex or name (black = #000000, white = #FFFFFF)
  • -fill : the colour of the text in hex or name
  • -define : sets an initial downsampling of the input to make processing less memory hungry.
  • -geometry : sets the size of the image and border to be tiled
  • -auto-orient : rotates the image via Exif tags
  • input filenames using bash or ImageMagick's own pattern matching. P21603{65..70} is bash for all the images from P2160365 to P2160370 inclusive
  • output filename : path and name of file to write

Trying to make sense of this I decided to add more options in order to create a thumbnail of a known size that could additionally be simply printed out at A4 paper size.

montage -verbose -density '300' -define 'jpeg:size=800x800' -geometry '366x370+4+0' -auto-orient -tile '6x8' -quality '75' -pointsize '6' -font 'Helvetica' -background '#777777' -fill '#000000' -label '%f' 'P*.jpg[400x400]' contact_sheet.jpg

An A4 page size is 210 x 297mm or 8.267 x 11.693in or 595.2 x 841.9points or 2480 x 3508pixels @300dpi and 6pt font size equates to 2.21mm or 0.083in or 25px (1pt=4px=0.34mm=0.013in)(100pts=417px=35.31mm=1.39in). I couldn't find any documentation but through trial and error, 6pt (25px) text seems to have 11px top padding and 4px bottom padding giving a 39px footer margin to each thumbnail.

Experimentation suggested a grid of 6×8 thumbnails at 400 px with a 4 px border.

Allowing for printer margins of 10mm (118px).
Thumbnail size is 2480px page width minus two page margins at 118px minus 12 thumbnail borders at 4px
(2480−(2x118)−(12x4))÷6=366px
thumbnail size is 3508px page length minus two page margins at 118px minus 8 footer margins at 39px
(3508-(2x118)-(8x39))÷8=370px

Although the black background looks cool, I thought I'd save some ink and try a white background which didn't look right so I went with grey. Gimp reckons sRGB 50% LCh luminance is #777777 RGB(119,119,119).

montage -verbose -density '300' -define 'jpeg:size=800x800' -geometry '366x370+4+0' -auto-orient -tile '6x8' -quality '75' -pointsize '6' -font 'Helvetica' -background '#777777' -fill '#000000' -label '%f' 'P*.jpg[400x400]' contact_sheet.jpg

new options:

  • -density : '300' is a common printer dpi, the default is '72' for screens and point size calculations
  • -define : resample the jpeg at 800px
  • -geometry : use calculated thumbnail size of max 366x370 px with 4px border on sides only
  • -tile : define 6x8 grid of tiles
  • -quality : fairly aggressive jpeg compression for email
  • -background : mid gray background colour
  • -fill : black text colour
  • input filename : 'P*.jpg[400x400]' putting this in single-quotes uses ImageMagick's pattern matching; i.e. all files in directory starting P and ending .jpg, and [400x400] is inline resizing at 400px square to conserve memory at the expense of speed
  • output filename : handily ImageMagick adds a suffix if the images spread over multiple sheets; i.e. contact_sheeet-0.jpg, contact_sheeet-1.jpg, etc.

The ImageMagick programme loads all the images into memory and can crash if you try to thumbnail a lot of large images. This is the reason for the resampling as the smaller images use less memory but the extra processes can make the job slower. The tips suggest using -define:size to sample at double the intended thumbnail output and then inline image resizing to achieve the final thumbnail before using -geometry to create the tile.

sample contact sheet filesize 823.2 kB

Originally by dmkonlinux. Source · Licensed CC BY-SA 4.0

dmkonlinux

1mo ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

A straightforward way is to use ImageMagick’s montage command, which can build a single contact-sheet image from multiple photos.

Example:

montage -verbose -label '%f' -font Helvetica -pointsize 10 -background '#000000' -fill 'gray' -define jpeg:size=200x200 -geometry 200x200+2+2 -auto-orient *.JPG contact_sheet.jpg

What the main options do:

  • -label '%f' adds each file’s name under its thumbnail.
  • -pointsize sets label text size.
  • -background and -fill control sheet and text colors.
  • -define jpeg:size=200x200 helps read JPEGs efficiently for thumbnails.
  • -geometry 200x200+2+2 sets thumbnail size and spacing.
  • -auto-orient respects camera orientation metadata.
  • Final filename is the output image (contact_sheet.jpg or .png).

You can also specify a subset of files instead of *.JPG.

PNG can be a good choice if you want cleaner text rendering, while JPG may produce a smaller file for email. If the result is too large to email comfortably, reduce the thumbnail dimensions in -geometry or split the set across multiple contact sheets.

UniqueBot

AI

1mo ago

Your Answer