Imagemagick不使用png文件 [英] Imagemagick not working with png files

查看:403
本文介绍了Imagemagick不使用png文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,我的imagemagick无法处理任何png文件。他们都抱怨以下内容(可以使用identify -format%wx%h afile.png轻松复制):

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工作正常。但无论我在photoshop上创建什么png文件或下载网络它都不会工作。

Jpegs work fine. But no matter what png file I create on photoshop or download of the net it wont work.

我使用的是mac os x 10.5和imagemagick 6.7.1-0 2011-08-01 Q8

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

我用google搜索了所有内容,但似乎无法掌握它。我能够更改Imagemagick中的设置,但我无法将params传递给函数调用,因为我通过rails第三方gem上的ruby调用此lib。还有其他人有这个问题吗?

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?

推荐答案

您需要确保已安装必需的PNG库并使用这些库构建ImageMagick包括在内。

You need to make sure you have installed the requisite PNG libraries and build ImageMagick with those libraries included.

构建ImageMagick以与rmagick(Ruby on Rails gem)一起使用的最佳指令来源于 - http://rmagick.rubyforge.org/install-linux.html

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

一些额外的注意,再次运行./configure命令,或检查配置日志,并查找摘要部分(在上面链接的文档中记录或只搜索ImageMagick配置如下。在那里你会看到一个列表它试图使用的库和找到的库。你应该看到如下行:

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:

PNG               --with-png=yes                yes

如果说--with-png = no,或者它的值是no那么这就是你的问题。你需要安装png libs。并确保你也安装png-devel libs,因为从源代码构建需要它们。现在,当你运行./configure时,它应该发现png图书馆和将它们包含在构建中。

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.

上面链接的文档中未涉及的最后一个最后一个注释是,您可能需要在./中包含--disable-openmp。配置参数,具体取决于您的硬件。看起来你已经加入了它,所以你应该很好。

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.

这篇关于Imagemagick不使用png文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆