Imagemagick 如何检查libpng版本

Imagemagick 如何检查libpng版本,imagemagick,libpng,Imagemagick,Libpng,我正在使用imagemagick,据我所知,它将png文件的处理委托给libpng库,因此我想知道如何检查使用了什么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| g

我正在使用
imagemagick
,据我所知,它将
png
文件的处理委托给
libpng
库,因此我想知道如何检查使用了什么
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

最简单的方法就是跑步

convert -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实例,请不要感到困惑;一个用于编码器/png.c解码png,另一个用于freetype,如果您安装了freetype。

此Ruby one衬里仅显示数字:

ruby -e 'im_formats = `convert -list format`; mdata = /(\(libpng\s)([^)]+)([)])/.match(im_formats); puts mdata[2];'
=> 1.6.34

我使用的是ubuntu 14.04的默认配置,第一个命令不返回任何内容,第二个命令没有提到
libpng
,尽管
imagemagick
工作正常,但是否有可能根本没有安装它?为ubuntu添加了一个hack@格伦安德斯·佩尔森可能知道一些更优雅的东西。@GlennRanders-Pehrson比我的黑客更简单、更可取-请你自己动手发布,我也会投你一票!感谢您的关注,并让我保持诚实:-)
ruby -e 'im_formats = `convert -list format`; mdata = /(\(libpng\s)([^)]+)([)])/.match(im_formats); puts mdata[2];'
=> 1.6.34