ImageMagick无法转换JPEG图片

5
我在新安装的Mac OSX Lion上使用ImageMagick转换JPEG时遇到了问题。我收到了以下错误信息:
convert: unable to open module file `/Users/natewade/.magick/jpeg.la': No such file or directory @ warning/module.c/GetMagickModulePath/813.
convert: no decode delegate for this image format `test1.jpg' @ error/constitute.c/ReadImage/544.
convert: no images defined `test1.jpg' @ error/convert.c/ConvertImageCommand/3044.

然而,与gif和其他格式的转换运作良好。在谷歌搜索后,我发现自2006年以来有许多人在网上遇到了同样的问题。但是他们中没有人发布解决方案。

当您配置Image Magic时,您可能会注意到这一点:

checking for JPEG... 
checking jconfig.h usability... no
checking jconfig.h presence... no
checking for jconfig.h... no
checking jerror.h usability... no
checking jerror.h presence... no
checking for jerror.h... no
checking jmorecfg.h usability... no
checking jmorecfg.h presence... no
checking for jmorecfg.h... no
checking jpeglib.h usability... no
checking jpeglib.h presence... no
checking for jpeglib.h... no
checking for jpeg_read_header in -ljpeg... no
checking for JPEG library is version 6b or later... no
checking if JPEG package is complete... no

解决方案应该在答案中,而不是问题中。此外,这更适合于superuser.com,因为这不是一个编程问题。 - Keith Thompson
嗨Keith,我把它放在这里是因为在寻找解决方法时,stackoverflow出现在搜索结果中最多,但从未发布过解决方案。 - Steffan Perry
3个回答

6

这个问题已经得到解决。这个错误出现在Mac OSX 10.7.3上,但是在搜索该问题后,我发现其他版本的OSX以及其他操作系统(似乎CentOS最多)也发布了相同的问题。同样的修复方法也适用于其他Linux版本。

修复问题非常简单。您只需要安装Libjpeg:

curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz
$ tar zxvf jpegsrc.v8c.tar.gz
$ cd jpeg-8c/
$ ./configure
$ make
$ sudo make install

重新安装ImageMagick,然后您就可以开始了。

1
这也困扰着我;我在OS X Lion上使用homebrew,安装了jpeg 8d和imagemagick 6.7.7-6,但在某些(不是全部)JPEG图像上,我会收到“convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3032.”的错误提示。 - Howard M. Lewis Ship
我在Ubuntu上遇到了同样的问题。同样的解决方法,Ubuntu风格:sudo apt-get install libjpeg-dev - philippe_b
安装后,我必须更改我的 ~/.profile 中的这一行:export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"export DYLD_LIBRARY_PATH="/usr/local/lib/" - Codezilla

5

需要安装Ghostscript - 适用于Mac

brew install ghostscript

brew link --overwrite ghostscript

brew reinstall imagemagick --build-from-source

0

您需要拥有JPEG库的特定头文件,换句话说,需要安装几个*-devel软件包,如libjpeg-turbo-devel、openjpeg-devel等。对于其他图像格式(如PNG、TIFF、WMF等),也是如此(例如libpng-devel、libtiff-devel、libwmf-devel、ghostscript-devel等)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接