Rmagick oh how I Hate and Love you <3

Okay, so for the past 4 days I have been dealing with attachment_fu’s and all of that which we love/hate it. I started building a basic photo uploader and photo gallery, but ran into some painful headaches.

I have played around with attachment_fu using Rmagick in the past, but for some strange reason I was running into all these issues. So I migrated to Image Science, but after dealing with pains on my Ruby on Rails VPS, I pushed this “problem” off and decided to continue coding and deal with server issues later.

Well today, I was tired of coding and figured its time to suck it up and deal with the pain. Well, I “sovled” the problem, but is not the perfered method for the long right. Right now I got Image Science working great on my mac mini (development machine) I have been resizing, croping, and creating thumbnails all day, but knew that I had to get it working on my VPS for it to be useful.

Well, I finally “solved” or rather changed my plan and am running Rmagick on my VPS and Image Science (for now) on my mac mini. I KNOW I have had Rmagick working great on my mac mini before, just not after this recent install. Anyway, heres some tips/tricks that have helped me with my VPS (Slicehost) and my mac mini.

Setup and Install Image Science:

SSH onto your VPS(Slicehost) running Ubuntu

Run the commands:

  • sudo apt-get install imagemagick
  • sudo apt-get install libmagick9-dev
  • sudo gem install rmagick

Bam, Change the :processor in has_attachments from :processor => ‘rmagick’ to :processor => ‘ImageScience’
and you should be good to go!

This worked for others who ARE running Image Science, but it did NOT work for me :( Anyway, maybe this will help you!

Installing Image Scinence requires FreeImage and RubyInline.

  • sudo wget http://ftp.cica.es/ubuntu/ubuntu/pool/universe/f/freeimage/freeimage_3.9.3.orig.tar.gz
  • sudo tar -xvf freeimage_3.9.3.orig.tar.gz
  • cd freeimage-3.9.3.repacked/FreeImage
  • sudo make
  • sudo make install
  • sudo gem install -y rubyinline
  • sudo gem install -y image_science

I hope that helps some Ruby N00bies that have been pulling out their hair with attachment_fu. Please let me know what image processor you are using for your photo resizing/croping/etc.


  1. What’s up, John! I stumbled upon your site while futzing w/attachment_fu. I’ve also had many issues with Rmagick, but have ended up sticking with it because it does seem to work pretty well *after* you figure out the nuances. We’ve been doing a *lot* of image processing using Rmagick and GSL for the face-based search services we’re writing for (soon-to-be-launched) Mugr.com, and *have* had success… but not without a fair share of hair pulling. Keep in touch.. -Preston

  2. Good tutorial! But maybe you should leave out “sudo” from the “wget”, “tar” and “make” commands. They are not necessary to be run with elevated privileges.