Imagemagick 无法处理 png 文件
由于某种原因,我的 imagemagick 无法处理任何 png 文件。他们都抱怨类似以下内容(可以使用识别-format%wx%h afile.png轻松复制):
identify: memory allocation failed `afile.png' @ error/png.c/ReadOnePNGImage/2123.
identify: corrupt image `afile.png' @ error/png.c/ReadPNGImage/3668.
Jpeg工作正常。但无论我在 Photoshop 上创建什么 png 文件或从网上下载它都不起作用。
我正在使用 mac os x 10.5 和 imagemagick 6.7.1-0 2011-08-01 Q8
CONFIGURE ./configure '--prefix=/usr/local' '--disable-static' '--with-modules' '--without-perl' '--without-magick-plus-plus' '--with-quantum-depth=8' '--disable-openmp' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts' 'LDFLAGS=-L/usr/local/lib' 'CPPFLAGS=-I/usr/local/include'
CONFIGURE_PATH /usr/local/etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX g++
CXXFLAGS -g -O2 -D_THREAD_SAFE -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib freetype jpeg jng lcms2 png tiff x11 xml zlib
DISTCHECK_CONFIG_FLAGS 'CPPFLAGS=-I/usr/local/include' 'LDFLAGS=-L/usr/local/lib' --disable-deprecated --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gs-font-dir=/usr/local/share/ghostscript/fonts --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6.7.1/
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES
FILTER_PATH /usr/local/lib/ImageMagick-6.7.1/modules-Q8/filters
HOST i386-apple-darwin9.8.0
LDFLAGS -L/usr/local/lib -L/usr/local/lib -L/usr/X11/lib -R/usr/X11/lib
LIB_VERSION 0x671
LIB_VERSION_NUMBER 6,7,1,0
LIBRARY_PATH /usr/local/lib/ImageMagick-6.7.1
LIBS -lMagickCore -llcms2 -ltiff -lfreetype -ljpeg -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lpthread
NAME ImageMagick
我已经用谷歌搜索了所有内容,但似乎无法掌握它。我可以更改 Imagemagick 中的设置,但我无法真正将参数传递给函数调用,因为我通过 ruby on Rails 第三方 gem 调用此库。还有其他人遇到过这个问题吗?
For some reason my imagemagick cant process any png files. They all complain with something like the following (can be replicated easily using identify -format %wx%h afile.png ):
identify: memory allocation failed `afile.png' @ error/png.c/ReadOnePNGImage/2123.
identify: corrupt image `afile.png' @ error/png.c/ReadPNGImage/3668.
Jpegs work fine. But no matter what png file I create on photoshop or download of the net it wont work.
I am using mac os x 10.5 and imagemagick 6.7.1-0 2011-08-01 Q8
CONFIGURE ./configure '--prefix=/usr/local' '--disable-static' '--with-modules' '--without-perl' '--without-magick-plus-plus' '--with-quantum-depth=8' '--disable-openmp' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts' 'LDFLAGS=-L/usr/local/lib' 'CPPFLAGS=-I/usr/local/include'
CONFIGURE_PATH /usr/local/etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX g++
CXXFLAGS -g -O2 -D_THREAD_SAFE -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib freetype jpeg jng lcms2 png tiff x11 xml zlib
DISTCHECK_CONFIG_FLAGS 'CPPFLAGS=-I/usr/local/include' 'LDFLAGS=-L/usr/local/lib' --disable-deprecated --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gs-font-dir=/usr/local/share/ghostscript/fonts --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6.7.1/
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES
FILTER_PATH /usr/local/lib/ImageMagick-6.7.1/modules-Q8/filters
HOST i386-apple-darwin9.8.0
LDFLAGS -L/usr/local/lib -L/usr/local/lib -L/usr/X11/lib -R/usr/X11/lib
LIB_VERSION 0x671
LIB_VERSION_NUMBER 6,7,1,0
LIBRARY_PATH /usr/local/lib/ImageMagick-6.7.1
LIBS -lMagickCore -llcms2 -ltiff -lfreetype -ljpeg -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lpthread
NAME ImageMagick
I have googled everything but cant seem to get a handle on it. I am able to change settings in Imagemagick but I cant really pass in params to the function calls as I am calling this lib through a ruby on rails third party gem. Has anyone else had this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要确保已安装必需的 PNG 库并使用包含的这些库构建 ImageMagick。
构建与 rmagick(Ruby on Rails gem)一起使用的 ImageMagick 的最佳说明位于源代码 - http ://rmagick.rubyforge.org/install-linux.html
一些附加说明,再次运行 ./configure 命令,或检查配置日志,并查找摘要部分(在链接的文档中注明)上面或只需搜索“ImageMagick 配置如下”,您将看到它正在尝试使用的库列表以及找到的内容,您应该看到类似这样的行:
如果它显示 --with-png=no,或者如果它显示。值为“no”,那么这就是您的问题。并确保您也安装了 png-devel 库,因为现在,当您运行 ./configure 时需要它们。 ,它应该发现 png 库并包含它们 。
最后一个注意事项(上面链接的文档中未提及)是,您可能需要在 ./configure 参数中包含 --disable-openmp,具体取决于您的硬件 而且看起来你已经包含了它,所以你应该很好。
You need to make sure you have installed the requisite PNG libraries and build ImageMagick with those libraries included.
The best instructions for building ImageMagick for use with rmagick (the Ruby on Rails gem) are at the source - http://rmagick.rubyforge.org/install-linux.html
Some additional notes, run your ./configure command again, or check your configure log, and look for the summary section (it is noted in the document linked above or just search for "ImageMagick is configured as follows". There you will see a list of libraries it is attempting to use and what are found. You should see a line like:
If it says --with-png=no, or if it has the value "no", then that is your problem. You need to install the png libs. And make sure you install the png-devel libs too, since they are needed for building from source. Now, when you run ./configure, it should discover the png libs and included them in the build.
One last final note, not covered in the document linked above, is that you might need to include --disable-openmp in your ./configure parameters, depending on your hardware. And it looks like you have included it, so you should be good.