ImageMagick,Bash脚本用注释和图像序列号标记 [英] ImageMagick, Bash script to label with comment and image sequence number

查看:162
本文介绍了ImageMagick,Bash脚本用注释和图像序列号标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为70张照片设置一张联系表。

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

而且,每张照片都与此标签类似:

And, each photo would have similar to this label:

n Comment

其中n表示图片编号。

我的Bash脚本正确显示评论。对于图像序列号,我很困惑。

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

我尝试了各种 fx:表达式和百分比转义结构,结果没有显示或数字为零
http://www.imagemagick.org/script/fx.php http://imagemagick.org/script/escape.php )。

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

推荐答案

我会这样做,使用MIFF将单独标记的文件附加到输出流,然后将它们全部从 stdin 读入蒙太奇命令:

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

它们看起来像这样:

这篇关于ImageMagick,Bash脚本用注释和图像序列号标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆