本文介绍了使用ImageMagick蒙太奇编号/标记图像(例如1,2,3或A,B,C)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

montage *.tif output.tif

将多个图像合并为一个。我现在希望它们被编号(有时1,2,3 ......; somtimes A,B,C ......)
有哪些可能性来标记组合中的单个图像?是否可以选择将标签放在图片下方,例如左上角或右下角?

to combine several images to one. I would now like them to be numbered (sometimes 1,2,3 …; somtimes A,B,C …)What possibilities are there to label the single images in the combined? Is there an option to put the label not underneath the picture but eg in the upper left or lower right corner?

不幸的是我无法弄清楚如何使用-label命令来实现这一点。感谢您的任何建议。

Unfortunately I could't really figure out how to use the -label command to achieve that. Thanks for any suggestions.

推荐答案

如果您想投入更多精力,您可以获得更多控制权。如果你这样做,你可以在你蒙太奇的时候标记on-the-fly,而不是将它们全部保存,然后对它们进行蒙太奇。您还可以更轻松地控制每行图像数量的宽度:

If you want to invest a little more effort you can have more control. If you do it like this, you can label the images "on-the-fly" as you montage them rather than having to save them all labelled and then montage them. You can also control the width, in terms of number of images per line, more easily:

#!/bin/bash
number=0
for f in *.tif; do
   convert "$f" -gravity northwest -annotate +0+0 "$number" miff:-
   ((number++))
done | montage -tile x3 - result.png

利用ImageMagick miff format,表示多图像文件格式,用于连接所有输出图像并将它们发送到蒙太奇 stdin >命令。

It takes advantage of ImageMagick miff format, which means Multiple Image File Format, to concatenate all the output images and send them into the stdin of the montage command.

或者,您可以像这样更改脚本:

Or, you can change the script like this:

#!/bin/bash
number=0
for f in *.tif; do
   convert "$f" -gravity northwest -fill white -annotate +0+0 "$number" miff:-
   ((number++))
done | montage -tile 2x - result.png

获取

或也许这......

Or maybe this...

#!/bin/bash
number=0
for f in *.tif; do
   convert "$f" -gravity northwest -background gray90 label:"$number" -composite miff:-
   ((number++))
done | montage -tile 2x - result.png

或使用字母...

#!/bin/bash
number=0
letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for f in *.tif; do
   label=${letters:number:1}
   convert "$f" -gravity northwest -background gray90 label:"$label" -composite miff:-
   ((number++))
done | montage -tile 2x - result.png

这篇关于使用ImageMagick蒙太奇编号/标记图像(例如1,2,3或A,B,C)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 08:02