4

I would like to have a set contact sheets for 70 photos.

And, each photo would have similar to this label:

n Comment

where n indicates the image number.

My Bash script correctly shows the comment. For the image sequence number I am puzzled.

#!/bin/bash 

/usr/bin/montage \
  -monitor  \
  -tile '3X3' \
  -label [useless attempts to number images]  %c \
  '/tmp/*-thumb.jpg' \
  ~/Desktop/SE-%d.jpg

I have tried various fx: expressions and percent escapes constructs with results either nothing displayed or the numeral zero (http://www.imagemagick.org/script/fx.php, http://imagemagick.org/script/escape.php).

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
bracket
  • 58
  • 3

1 Answers1

2

I would do it something like this, using a MIFF to append individually labelled files to an output stream then read them all from stdin into the montage command:

#!/bin/bash
i=0
for f in /tmp/*-thumb.jpg; do
  convert -label "$i Comment %f" "$f" miff:-
  ((i++))
done | montage -       \
   -frame 5            \
   -tile 3x3           \
   -geometry +10+10    \
   -background black   \
   ~/Desktop/TheAnswer.jpg

They come out looking like this:

enter image description here

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432