Libjpeg collision when using RMagick (ImageMagick) and Image

I have a Rails app that uses BackgroundRB to process images. I’ve been
using a class that uses RMagick for quite some time without any issues
at all. I recently added a new class that processes images using
image_science instead of RMagick. After adding this new class and the
image_science gem RMagick throws the following error:

JPEG parameter struct mismatch: library thinks size is 428, caller
expects 464 `’ - (Magick::ImageMagickError)

on this method: magick_image = Magick::Image.from_blob(image_blob)

When I uninstall image_science the class that uses RMagick ceases to
throw the above error.

Here are my thoughts: image_science uses FreeImage, which ships with
its own version of libjpeg. When Rails boots up it loads the
image_science gem first, which loads FreeImage, which loads its own
libjpeg. When RMagick gets loaded, is it possible that RMagick/
ImageMagick will not use the libjpeg that is in /usr/lib and instead
use the one that was loaded by image_science/FreeImage?

This is of FC4 (i686 athlon i386 GNU/Linux) with Ruby 1.8.4 and the
most recent versions of ImageMagick and RMagick.

Any help would be greatly appreciated!

Erik

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs