我在OSX 10.9上安装了GM。执行gm version
会输出以下内容:
GraphicsMagick 1.3.18 2013-03-10 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2013 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
DPS no
FlashPix no
FreeType no
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG no
Little CMS no
Loadable Modules no
OpenMP no
PNG no
TIFF no
TRIO no
UMEM no
WMF no
X11 no
XML yes
ZLIB yes
Host type: x86_64-apple-darwin13.0.0
Configured using the command:
./configure
Final Build Parameters:
CC = gcc
CFLAGS = -g -O2 -Wall -D_THREAD_SAFE
CPPFLAGS = -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
CXX = g++
CXXFLAGS = -D_THREAD_SAFE
LDFLAGS = -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib
LIBS = -lbz2 -lxml2 -lz -lm -lpthread
尝试执行以下命令:
String[] commands = new String[]{"identify", "-format", "%h|%w|%b|%t|%e", image_file.getAbsolutePath()};
返回错误信息:
org.gm4java.engine.GMException: identify: No decode delegate for this image format (/Users/latu/Desktop/vent.tiff)。
根据版本输出,我认为某些原因禁用了TIFF支持,但我似乎找不到解决方案。我还尝试直接从终端执行命令(gm identify path),但返回相同的错误消息。如果您能提供任何关于可能导致此问题的反馈,将不胜感激。
更新:
我已安装tiff、zlib和jpeg库,但在运行./configure时仍然出现此问题。
checking for TIFF support ...
checking tiff.h usability... no
checking tiff.h presence... no
checking for tiff.h... no
checking tiffio.h usability... no
checking tiffio.h presence... no
checking for tiffio.h... no
checking for TIFFOpen in -ltiff... no
checking for TIFFClientOpen in -ltiff... no
checking for TIFFIsByteSwapped in -ltiff... no
checking for TIFFReadRGBATile in -ltiff... no
checking for TIFFReadRGBAStrip in -ltiff... no
checking if TIFF package is complete... no
/usr/local
中,并且头文件在/usr/local/include
中,你需要告诉configure去哪里查找。你也可以使用homebrew通过单个brew install graphicsmagick
轻松安装所有内容。Homebrew还可以帮助你解决构建环境的一般问题。 - JimB