A ruby wrapper for ImageMagick or GraphicsMagick command line.
Tested on the following Rubies: MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0, REE, JRuby, Rubinius.
Add the gem to your Gemfile:
gem "mini_magick"I was using RMagick and loving it, but it was eating up huge amounts of memory. Even a simple script would use over 100MB of Ram. On my local machine this wasn't a problem, but on my hosting server the ruby apps would crash because of their 100MB memory limit.
Using MiniMagick the ruby processes memory remains small (it spawns ImageMagick's command line program mogrify which takes up some memory as well, but is much smaller compared to RMagick)
MiniMagick gives you access to all the commandline options ImageMagick has (Found here http://www.imagemagick.org/script/mogrify.php)
Want to make a thumbnail from a file...
image = MiniMagick::Image.open("input.jpg")
image.resize "100x100"
image.write "output.jpg"Want to make a thumbnail from a blob...
image = MiniMagick::Image.read(blob)
image.resize "100x100"
image.write "output.jpg"Got an incoming IOStream?
image = MiniMagick::Image.read(stream)