您如何使用antotate'用蒙太奇'或在图像目录上使用convert的循环A管道循环,to to to to``蒙太奇?
我已经尝试了几天来编写一个脚本,该脚本从图像目录中创建一个简单的证明表。我找到标签
图像的唯一脚本,我不喜欢。我想按标记在图像本身上, ... 。
我无法使用Annotate
而不是标签
带有montage
,并且找不到在线示例。那将是理想的。如果有人知道如何实施它,我会更喜欢它。
到目前为止,我要做的是首先ress
和Annotate
将图像放入单独的目录中,然后使用montage
创建证明表。这有效,但缺点是制作有损副本的有损副本,并要求将文件写入目录。
我试图将转换
的输出输送到montage
,但没有成功。那将是第二好的解决方案。如果有人知道该怎么做,那将非常有帮助。
这有效,但是……:
d="<path to image directory>"
dirname=`basename "$d"`
echo $dirname
parent=`dirname "$d"`
echo $parent
parentdir=`basename "$parent"`
echo $parentdir
cd "$d"
if [ -f "$parentdir-$dirname proof sheet.jpg" ]
then
rm "$parentdir-$dirname proof sheet.jpg"
fi
tilenum=5
spacing=1
scrw=$((1920-(tilenum*spacing+spacing)))
imgw=$(($scrw/$tilenum))
echo $imgw
if [ ! -d rszannot ]
then
mkdir rszannot
else
rm rszannot/*
fi
shopt -s nullglob # prevents errors for extensions not found
shopt -s nocaseglob # case insensitive args
for f in "${arg}"*.{jpg,jpeg,png,gif}
do
fn=$(basename "${f%.*}")
convert -verbose "$f" \
-define jpeg:size=${imgw}x \
-quality 100 \
-resize ${imgw}x \
-gravity south \
-pointsize 20 \
-stroke '#000C' -strokewidth 2 -annotate 0 '%f' \
-stroke none -fill white -annotate 0 '%f' \
"rszannot/$fn-${imgw}x.jpg"
done
cd rszannot
montage -verbose \
-quality 100 \
-background black \
-geometry +${spacing}+${spacing} \
-tile ${tilenum}x \
*.jpg \
"../$parentdir-$dirname proof sheet.jpg"
open "../$parentdir-$dirname proof sheet.jpg"
shopt -u nocaseglob
shopt -u nullglob
I have been trying for days to write a script that creates a simple proof sheet from a directory of images. The only scripts I found label
the images, which I don't like. I wanted to annotate
them as per Labeling on top of the Image itself....
I was unable to use annotate
rather than label
with montage
and could find no examples online. That would be ideal. If someone knows how to implement that, I would prefer it.
What I did so far is to first resize
and annotate
the images into a separate directory and then create the proof sheet using montage
. That works but has the disadvantage of making lossy copies of lossy copies and requiring writing files to a directory.
I tried to pipe the output of the convert
for loop to montage
but didn't succeed. That would be the second best solution. If anyone knows how to do that, that would be very helpful.
This works but…:
d="<path to image directory>"
dirname=`basename "$d"`
echo $dirname
parent=`dirname "$d"`
echo $parent
parentdir=`basename "$parent"`
echo $parentdir
cd "$d"
if [ -f "$parentdir-$dirname proof sheet.jpg" ]
then
rm "$parentdir-$dirname proof sheet.jpg"
fi
tilenum=5
spacing=1
scrw=$((1920-(tilenum*spacing+spacing)))
imgw=$(($scrw/$tilenum))
echo $imgw
if [ ! -d rszannot ]
then
mkdir rszannot
else
rm rszannot/*
fi
shopt -s nullglob # prevents errors for extensions not found
shopt -s nocaseglob # case insensitive args
for f in "${arg}"*.{jpg,jpeg,png,gif}
do
fn=$(basename "${f%.*}")
convert -verbose "$f" \
-define jpeg:size=${imgw}x \
-quality 100 \
-resize ${imgw}x \
-gravity south \
-pointsize 20 \
-stroke '#000C' -strokewidth 2 -annotate 0 '%f' \
-stroke none -fill white -annotate 0 '%f' \
"rszannot/$fn-${imgw}x.jpg"
done
cd rszannot
montage -verbose \
-quality 100 \
-background black \
-geometry +${spacing}+${spacing} \
-tile ${tilenum}x \
*.jpg \
"../$parentdir-$dirname proof sheet.jpg"
open "../$parentdir-$dirname proof sheet.jpg"
shopt -u nocaseglob
shopt -u nullglob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在子外壳中调整和注释所有图像,然后保存到Miff:然后将其用在Unix ImageMagick中的蒙太奇。这是一个示例:
You can resize and annotate all your images in a sub shell and save to miff:, then pipe that to montage in Unix Imagemagick. Here is an example: