Paperclip error - NotIdentifiedByImageMagickError

Minh Tri Pham picture Minh Tri Pham · May 16, 2014 · Viewed 12.2k times · Source

I'm trying to upload images to aws s3 with paperclip but I get this error

Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1u773ft.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-kfejir.jpg'

In my model, I set up these styles

 has_attached_file :photo, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename", :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/assets/profile/iama.png"

When I remove these styles, everything works, but I really need them.

I'm using Rails 3.2.16 and

  paperclip (4.1.1)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types

I already installed ImageMagick and the rmagick gem

Help me please.

Answer

Minh Tri Pham picture Minh Tri Pham · May 16, 2014

The problem was that my ImageMagick didn't have JPEG delegates. I found out using convert -list format. So I reinstalled ImageMagick using MacPorts and reinstalled rmagick with the new Paths to ImageMagick.