Damien Tanner

Super simple image resizing

by

Everyone knows ImageMagick is a goddam pain to install and a beast of a library to use for simple image resizing and cropping. ImageScience is on the way, but it's still easy to bump into issues compiling Freeimage. If all you want to do is resize (and crop) libgd is even more lightweight (and tiny enough to do away with DarwinPorts). With a bit of inline C we can do some really lean image resizing.

SfsResize (sfs_resize.rb) is a super simple image resizer. Compile libgd in a few minutes (there is an OS X how-to) and then use it like this:


w = 100
h = 100
s = SfsResize.new("in.gif")
s.resize_and_write_to_file("out.gif", w, h)

Severely untested, but good fun nevertheless.