Tim Hunter
5/18/2006 11:40:00 PM
Jonathan Heinen wrote:
> Hello,
>
> i'm just starting with ruby! =) ... i would better say with ruby on rails!
> Now I want to maipulate some pictures (resize for first)! I found RMagic
> and MiniMagic! .. Both make use of ImageMagic! Aren't there any
> standalone ruby solutions? When not! Why not? Id should be posible to
> load and manipulate the files? Or are there any preformance problems
> manipulating big files?
>
> Jonathan
Performance is the big issue, imo, followed by reliability and breadth
of features. As far as I know there are two big players in the open
source image processing field, ImageMagick (and its fork,
GraphicsMagick) and GD. I can't speak for GD but I understand it's a
very high-quality library.
Regarding performance, how big are the images you're wanting to resize?
Your off-the-shelf point 'n shoot digital camera will generate images
between 3 and 6 megapixels. That's a lot of pixels, and resizing (to
make thumbnails, for example) requires a lot of arithmetic per pixel to
produce a quality result. Ruby has many fine features but speed is
not its strong point.
Regarding reliability and breadth of features, I know a little bit about
ImageMagick. It's been available since 1990 (so it's about the same age
as Linux) and it currently supports over 95 image formats, including all
the biggies like JPG, GIF, PNG, TIFF, PDF, EPS, WMF, BMP, MPEG, etc. and
a lot of the not-so-biggies like the IBM PC Paintbrush file format.
There easily over 100 functions in its API. It has 4 different functions
just for resizing alone, and the main one, ResizeImage, accepts 15
different "filter" options to control how the resizing is done. (You
might choose a different filter to resize, say, a CAD drawing than the
one you'd choose when resizing a digital photograph.) All of these
functions are carefully tuned to handle very large images.
The cost of all this functionality is that ImageMagick can be a chore to
install, depending on the platform you choose. ImageMagick relies on a
dependent libraries (like libjpeg, libtiff, libpng, etc.) to do read and
write most of the file formats it supports, so you have to install the
dependent libraries before you can even start installing ImageMagick. If
your platform makes these libraries available as binary installs (via
apt-get or urpmi, for example) then the job is easier.