问题
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).
回答1:
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:
来源:https://stackoverflow.com/questions/28444051/imagemagick-bash-script-to-label-with-comment-and-image-sequence-number