我想使用imagemagick为照片添加水印。我正在使用OSX和Python脚本代码,并尝试从(http://www.imagemagick.org/Usage/text/#pango_markup)的代码目前我正在努力理解为什么我不能让图像出现。
serinitus:nppPhotos ns$ convert -background lightblue -gravity center -size 180x \
> pango:"The <b>bold</b> and <i>beautiful</i>" \
> pango_formatting.gif
convert: unable to open image `The <b>bold</b> and <i>beautiful</i>': No such file or directory @ error/blob.c/OpenBlob/2658.
convert: no decode delegate for this image format `PANGO' @ error/constitute.c/ReadImage/501.
convert: no images defined `pango_formatting.gif' @error/convert.c/ConvertImageCommand/3187.
serinitus:nppPhotos ns$
安装的版本是ImageMagick 6.8.9-7 Q16 x86_64 2014-09-14和pango-1.36.7通过自制程序。
我尝试使用--with-pango标志重新安装ImageMagick。
我有两个选择之一:我在命令行中遗漏了一些非常明显的东西(甚至认为我已经复制/粘贴了它),或者有一个配置错误,就像brew在OSX Lion上安装imagemagick一样。
它看起来好像Pango没有安装。以下两个命令中的任何一个都会告诉您ImageMagick是否知道Pango:
convert -list format
identify -list format
输出:
Format Module Mode Description
-------------------------------------------------------------------------------
3FR DNG r-- Hasselblad CFV/H3D39II
AAI* AAI rw+ AAI Dune image
AI PDF rw- Adobe Illustrator CS2
ART* ART rw- PFS: 1st Publisher Clip Art
ARW DNG r-- Sony Alpha Raw Image Format
AVI MPEG r-- Microsoft Audio/Visual Interleaved
AVS* AVS rw+ AVS X image
BGR* BGR rw+ Raw blue, green, and red samples
BGRA* BGR rw+ Raw blue, green, red, and alpha samples
BMP* BMP rw- Microsoft Windows bitmap image
...
PAM* PNM rw+ Common 2-dimensional bitmap format
PANGO* PANGO --- Pango Markup Language
或者,如果您不喜欢浏览列表:
identify -list format | grep -Ei "Description|pango"
Format Module Mode Description
PANGO* PANGO --- Pango Markup Language
你正在为r
寻找read
的w
和write
的Mode
。正如你所看到的,我也没有Pango :-)
我使用El Capitan上的以下命令:brew更新
brew uninstall --force pango
brew rm gobject-introspection
brew deps imagemagick --with-pango
brew install imagemagick --build-from-source --with-pango
brew install imagemagick --build-from-source --with-pango
不再工作,选项已被删除,github问题供参考https://github.com/Homebrew/homebrew-core/issues/31510
如果有人提出了一个好的解决方案,他们可能会重新实施该选项
在此期间你可以尝试这个
brew install imagemagick
brew install pango librsvg
brew install cairo --build-from-source
如果您已经安装了软件包,请尝试使用brew reinstall package_name