gpt4 book ai didi

bash - ImageMagick,Bash 脚本,用于标记注释和图像序列号

转载 作者:行者123 更新时间:2023-11-29 09:31:50 26 4
gpt4 key购买 nike

我想要一套 70 张照片的联系表。

而且,每张照片都会有类似这样的标签:

n Comment

其中 n 表示图像编号。

我的 Bash 脚本正确显示了注释。对于图片序号我很疑惑。

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

最佳答案

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

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

它们看起来像这样:

enter image description here

关于bash - ImageMagick,Bash 脚本,用于标记注释和图像序列号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28444051/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com