h1. FastImage Resize h4. FastImage Resize is an extremely light solution for resizing images in ruby by using libgd FastImage Resize will resize gifs, jpegs, and png files. It uses resampling to get good looking results. And it doesn't rely on installing external heavy libraries such as RMagick (which relies on ImageMagick or GraphicsMagick) or ImageScience (which relies on FreeImage). h2. Examples

  require 'fastimage_resize'

  FastImage.resize("http://stephensykes.com/images/ss.com_x.gif", "my.gif", 100, 20)
  => 1
The file my.gif is created locally, containing the resized image. h2. Installation First check the requirements section below. h4. Gem

  sudo gem install sdsykes-fastimage_resize -s http://gems.github.com
h4. Rails Install the gem as above, and configure it in your environment.rb file as below:

...
Rails::Initializer.run do |config|
  ...
  config.gem "sdsykes-fastimage_resize", :lib=>"fastimage_resize"
  ...
end
...

You may also need this in your environment.rb so that the rails process puts the compiled C code in a place it can access:

ENV['INLINEDIR'] = RAILS_ROOT + "/tmp"  # for RubyInline

Then you're off - just use FastImage.resize() in your code as in the examples. h2. Requirements * RubyInline

  sudo gem install RubyInline
* FastImage

  sudo gem install sdsykes-fastimage -s http://gems.github.com
* Libgd See "http://www.libgd.org/":http://www.libgd.org/ Libgd is commonly available on most unix platforms, including OSX. h2. Documentation "http://rdoc.info/projects/sdsykes/fastimage_resize":http://rdoc.info/projects/sdsykes/fastimage_resize h2. Caveats Because of the way that libgd works, gif files that have transparency may not always come through with the transparency perfectly retained. h2. Tests You'll need to 'sudo gem install fakeweb' to be able to run the tests h2. References * "http://blog.new-bamboo.co.uk/2007/12/3/super-f-simple-resizing":http://blog.new-bamboo.co.uk/2007/12/3/super-f-simple-resizing