Sha256: fdfad66721b6cc14a6ce6fde3789793f78ed7ba98af8edec4355bb3fa8a1365a
Contents?: true
Size: 1.82 KB
Versions: 1
Compression:
Stored size: 1.82 KB
Contents
MiniMagick ========== A ruby wrapper for ImageMagick command line. Why? --- I was using RMagick and loving it, but it was eating up huge amounts of memory. A simple script like this... Magick::read("image.jpg") do |f| f.write("manipulated.jpg") end ...would use over 100 Megs of Ram. On my local machine this wasn't a problem, but on my hosting server the ruby apps would crash because of their 100 Meg memory limit. Solution! --------- 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) Examples -------- Want to make a thumbnail from a file... image = MiniMagick::Image.from_file("input.jpg") image.resize "100x100" image.write("output.jpg") Want to make a thumbnail from a blob... image = MiniMagick::Image.from_blob(blob) image.resize "100x100" image.write("output.jpg") Need to combine several options? image = MiniMagick::Image.from_file("input.jpg") image.combine_options do |c| c.sample "50%" c.rotate "-90>" end image.write("output.jpg") Want to manipulate an image at its source (You won't have to write it out because the transformations are done on that file) image = MiniMagick::Image.new("input.jpg") image.resize "100x100" Requirements ------------ You must have ImageMagick installed. How To Install -------------- (I've only tested this on OS X and Linux) I've packaged up MiniMagick as a rails plugin. Just unzip the file to the /vendor/plugins directory of your rails folder and you have access to all the magick. MiniMagick does NOT require rails though. All the code you need to use MiniMagick is located in the mini_magick/lib/mini_magick.rb file.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mini_magick-1.0.1 | README |