ImageMagick 的蒙太奇命令不从文件中读取

montage command of ImageMagick does not read from file

我用Ubuntu 14.0.4。我们可以使用此命令按名称标记每个图像:

montage -label '%t' -size 512x512 "./img/*.*[120x90]" -geometry +5+5 photo.png

我想通过文本文件中的字符串列表来标记图像。 Docs say:

-label name

Use this option to assign a specific label to the image ... If the first character of string is @, the image label is read from a file titled by the remaining characters in the string. Labels in a file are literal, no embedded formatting characters are recognized.

但是我无法使用文件提供标签。我使用这样的命令:

montage -label @un.txt -size 512x512 "./img/*.*[120x90]" -geometry +5+5 photo.png 

上面,un.txt./img/路径下的文本文件名。这是示例结果:

结果,所有图像都标有字符串 @un.txt 而不是 un.txt 的内容。我也在 terminal:

中收到此错误

montage.im6: improper image header `./img/un.txt' @ error/txt.c/ReadTXTImage/429

如果我移动 un.txt到当前(.)目录并再次运行上面的命令,我会得到这个图像(没有标签)和以下错误:

montage.im6: not authorized `@un.txt' @ error/property.c/InterpretImageProperties/2959.

注:

  1. 所有图片都是jpg
  2. ImageMagick 的版本是ImageMagick 6.7.7-10

更新答案

也许您对 label 的语法有误:

convert -size 100x100 xc:red label:@label.txt -append result.png

其中 label.txt 包含 fred

原答案

可能与ImageMagick中发现的漏洞有关,见here

您需要更新站点策略文件。您可以通过 运行 找到位置:

convert -debug configure logo: null: 2>&1 | grep -Ei "Searching|Loading"

并且它将与其他 XML 配置文件位于相同的 directory/folder。