rlucas.net: The Next Generation Rotating Header Image

Installing RMagick on OS X with Fink

Hold on: I’m not sure that the below works right. Don’t use it yet.

There are lots of instructions out there for installing RMagick, which is a graphics manipulation library used by many Ruby-istas for things like thumbnailing, resizing, etc. I wanted to use it for an internal database I’m building in Rails.

Some of the sites offering instructions:

  • The RMagick site itself. This one is tilted toward using Darwin Ports (the BSD-ish way to do third party package management on your mac; I prefer the Debian-ish “Fink”).
  • Hivelogic. This one involves manual downloads of tarballs and configure; make; make install type loving. I don’t like this way of going about it because you lose the package management features.

But nobody seemed to have a Fink-friendly way to do this.

If you naively try to install with gem install rmagick, you’ll get something like:

configure: error: Can't install RMagick. Can't find libMagick or one of the dependent libraries. Check the config.log file for more detailed information.

My solution:

1. Install the needed dependencies from binaries using Fink. 2. Use gem install to install RMagick (the Ruby bit) itself.

The dependencies include (as best I can tell):

freetype freetype-shlibs imagemagick imagemagick-dev imagemagick-shlibs ghostscript ghostscript-fonts gv libpng-shlibs libjpeg libjpeg-bin libjpeg-shlibs lcms lcms-bin lcms-shlibs libtiff libtiff-bin libtiff-shlibs

Therefore, you should probably be able to install simply by doing:

sudo apt-get install freetype freetype-shlibs imagemagick imagemagick-dev imagemagick-shlibs ghostscript ghostscript-fonts gv libpng-shlibs libjpeg libjpeg-bin libjpeg-shlibs lcms lcms-bin lcms-shlibs libtiff libtiff-bin libtiff-shlibs

sudo gem install rmagick

(I realize that this is probably overkill and that you don’t actually need all those packages above. If you figure out the minimal subset, why don’t you post a similar blog entry of your own?)

Good luck!

One Comment

  1. Mubarak says:

    I found this post with a Google search I’ve been drnaimeg of the same tool for a long time now, and after MUCH experimentation came upon the same process you describe. I’ve been using the same process successfully for over a year. It actually works very well, producing very usable and quite compact pdf images, with file sizes smaller than ones created on the Acrobat 4 I was using on my old Mac.One thing I do because I tend to use ancient throwaway PCs with limited processing power, and since imagemagick doesn’t care what the source files are, it’s fastest to scan in Xsane’s default format (pnm) rather than tiff you don’t have to wait for the image to convert after each page is scanned. As you have noticed, you MUST include the density command or you won’t get the results you expect from imagemagick.If you use KDE, it’s pretty easy to install a script that you can call up in Konqueror with a right-click contextual menu. I created one I named Convert to PDF which performed the convert and ps2pdf steps. I’m sure I could use the same script in GNOME but I haven’t gotten around to figuring it out yet.One important issue I have not yet resolved (though I may be close): unfortunately ps2pdf seems to have US Letter set as the default page size. Normally this does not cause me a problem, because 99% of the time I’m scanning from US Letter to US Letter documents. HOWEVER, if I’m scanning a small booklet (or probably a legal size document, though I haven’t done that lately), ps2pdf apparently ignores the boundingbox of the original images, converting it to US Letter. This has the very unfortunate side effect of putting the resulting image in the lower left corner of the page (starting at 0,0 coordinates for PostScript). This may be a bug introduced in later versions of Ghostscript, because it doesn’t seem to be widely acknowledged I have found the gs commands to set the height and width that work with ps2pdf. Additionally there are commands in imagemagick and gs that will extract the original image’s height and width. SO it’s probably just a matter of writing a script to do all the parsing and building up a command line.Anyway, if I make any progress on this in the next little bit I’ll try to report back. I’m glad to find someone else looking for this function from their linux boxes!

Leave a Reply

Your email address will not be published. Required fields are marked *