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).

4

1 回答 1

2

我会这样做,使用 MIFF 将单独标记的文件附加到输出流,然后将它们全部读取stdinmontage命令中:

#!/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

他们出来看起来像这样:

在此处输入图像描述

于 2015-02-11T09:43:45.130 回答