开发者

Paperclip error: "no decode delegate for this image format"

开发者 https://www.devze.com 2023-01-09 14:15 出处:网络
I use Windows 7 and I installed ImageMagic. I can run Identify command from console without a problem.

I use Windows 7 and I installed ImageMagic. I can run Identify command from console without a problem.

But when I use my Rails application (run from Aptana RadRails IDE), it gives me an error:

Magick: no decode delegate for this image format `/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'' @ error/constitute.c/ReadImage/532.
Magick: no decode delegate for this image format `/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'' @ error/constitute.c/ReadImage/532.


[paperclip] c:/ImageMagick-6.6.3-Q16/identify -format %wx%h  'C:/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError::/Users/karl/AppData/Local/Temp/stream,5000,1.jpg is not recognized by the 'identify' command.>
[paperclip] c:/ImageMagick-6.6.3-Q16/identify -format %wx%h  'C:/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: C:/Users/karl/AppData/Local/Temp/stream,5000,1.jpg is not recognized by the 'identify' command.>

If I try to run the same command from console, it works OK (Under any user). (NOTE: I did not add the quotes)

C:\Users\karl>c:/ImageMagick-6.6.3-Q16/identify -format %wx%h C:/Users/karl/AppData/Local/Te开发者_StackOverflow社区mp/stream,5000,1.jpg[0]
600x450

One interesting thing is that if I run the command manually with quotes ('), then I get the same error.

C:\Users\karl>c:/ImageMagick-6.6.3-Q16/identify -format %wx%h 'C:/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'
Magick: no decode delegate for this image format `/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'' @ error/constitute.c/ReadImage/532.

I tried to modify Paperclip to work in a way that it would not add quotes, but it did not seem to make any difference or I just did something wrong.


I had the same issue when installing on Linux. First, if you are using a client library (MagickWand for php, for example) then you need to make sure that image libraries are installed first, then imagemagick, then your extension.

While I'm not sure what the Windows equivalent is, I always make sure to have libjpeg-devel and libpng-devel.

In order to check what delegates you have, you can run convert -list form, and that will print a list of formats ImageMagick knows how to work with.


If you get this error when working with TTF fonts and ImageMagick, you also need to install freetype-devel prior to running ./configure . Also make sure you run the "make check" after installing it per their install from source link at http://imagemagick.org.


Try to find line 109 in the file lib/paperclib.rb:

params = quote_command_options(*params).join(" ")

And replace it with:

params = params.join(" ")
0

精彩评论

暂无评论...
验证码 换一张
取 消