我正在使用
imagemagick
,据我了解,它将 png
文件的处理委托给 libpng
库,所以我想知道如何检查使用的 libpng
版本?
最简单的方法就是跑步
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 中使用。
您可以尝试以下任一方法:
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
这个 Ruby 单行仅显示数字:
ruby -e 'im_formats = `convert -list format`; mdata = /(\(libpng\s)([^)]+)([)])/.match(im_formats); puts mdata[2];'
=> 1.6.34
如果您对系统上安装的 libpng 版本感兴趣,您可以使用:
/usr/bin/libpng-config --version