James said:
Ooh! Thanks for the link.
Something else you might want to check out, James, is RMagick
(
http://rmagick.rubyforge.org/). This is a Ruby interface (not in the
Java sense) to allow image manipulation via ImageMagick, or
GraphicsMagick. It's a bit tedious to install, but it appears to be
quite powerful.
I'd like to say, I installed RMagick, and expected to have to do a bunch
of work to get the image info and some relatively involved manipulations
I wanted, but it was dead simple. RMagick kicks butt.
Here's a snippet from a Rails app of mine. (This is simple
thumbnail-making, not the stuff I was talking about above.) image_data
is the contents of an uploaded image, as a string. THUMB_GEOMETRY is
"120x120>", meaning shrink to fit inside a 120x120 box unless it already
does.
image = Magick::Image.from_blob(image_data).first
image.change_geometry(THUMB_GEOMETRY) do |cols, rows, image|
image.resize! cols, rows
end
image.write File.join(RAILS_ROOT, 'public', thumbnail)
Cheers,
Dave