【发布时间】:2016-02-11 14:10:58
【问题描述】:
我正在使用imagemagick,据我了解,它将png 文件的处理委托给libpng 库,所以我想知道如何检查使用的libpng 版本?
【问题讨论】:
标签: imagemagick libpng
我正在使用imagemagick,据我了解,它将png 文件的处理委托给libpng 库,所以我想知道如何检查使用的libpng 版本?
【问题讨论】:
标签: imagemagick libpng
您可以尝试以下任一方法:
convert -debug coder xc: a.png 2>&1 | grep version
IM version = 6.9.2-5
Libpng version = 1.6.18
Zlib version = 1.2.5
或者,这个
identify -list configure| grep CFLAGS
CFLAGS -I/usr/include/libxml2 -I/usr/local/Cellar/libpng/1.6.18/include/libpng16 -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/fontconfig/2.11.1/include -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/pixman/0.32.8/include/pixman-1 -I/usr/local/Cellar/glib/2.46.1_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.1_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/cairo/1.14.4/include/cairo -D_REENTRANT -I/usr/local/Cellar/libpng/1.6.18/include/libpng16 -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/fontconfig/2.11.1/include -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/pixman/0.32.8/include/pixman-1 -I/usr/local/Cellar/glib/2.46.1_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.1_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/cairo/1.14.4/include/cairo -I/usr/local/Cellar/gdk-pixbuf/2.32.1/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/librsvg/2.40.11/include/librsvg-2.0 -I/usr/local/Cellar/libpng/1.6.18/include/libpng16 -I/usr/local/Cellar/xz/5.2.2/include -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/fontconfig/2.11.1/include -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -g -O2 -Wall -mtune=core2 -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PCFLAGS -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
或者,在 Ubuntu 上
strace convert xc: a.png 2>&1 | grep open | grep libpng
【讨论】:
libpng,有没有可能它根本没有安装,尽管 imagemagick 工作得很好?
最简单的方法是运行
convert -list format | grep PNG
或
identify -list format | grep PNG
这会报告正在使用的 libpng 和 zlib 版本。
有时你会看到类似的东西
PNG* rw- 便携式网络图形 (libpng 1.6.17,1.6.18)
这意味着 ImageMagick 是使用 libpng-1.6.17 编译的,并且使用更新的共享库 libpng-1.6.18 运行。这是无害的,除非这显示了两个不兼容的版本,例如 (libpng-1.2.44, 1.6.18)。
在 Ubuntu 和其他 *nix 平台上,您还可以从中获取有用的信息
ldd `which convert`
如果后面的命令显示两个或多个 libpngNN 实例,请不要感到困惑;一个被 coders/png.c 用来解码 PNG,另一个在 freetype 中使用,如果你已经安装了 freetype。
【讨论】:
这个 Ruby 单行只显示数字:
ruby -e 'im_formats = `convert -list format`; mdata = /(\(libpng\s)([^)]+)([)])/.match(im_formats); puts mdata[2];'
=> 1.6.34
【讨论】: