views:

172

answers:

2

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/Temp/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.

A: 

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.

Chris Henry
A: 

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

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

And replace it with:

params = params.join(" ")
floatless
Unfortunately I don't have quote_command_options string in my paperclip.rb file. I took this version from git some days ago and installed as a plugin.
Karl
Wow, I got this sources from GitHub too: http://github.com/thoughtbot/paperclip/blob/3be55fc85f15a79f1306aba334a6737f6d715991/lib/paperclip.rb#L109
floatless
Could you try to remove quotes in the `geometry.rb`? I don't know which version of paperclip you're using. http://github.com/thoughtbot/paperclip/blob/v2.3.0/lib/paperclip/geometry.rb#L19
floatless
The first link you have is from previous beta version and it is different in the latest version (in master branch). In geometry file it does not have quotes: Paperclip.run("identify", "-format %wx%h :file", :file => "#{file}[0]")
Karl
This will solve my problem, but I moded my development environment to Ubuntu and this problem disappeared there.
Karl