mini replacement for RMagick
Ruby PHP
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit ahead, 614 commits behind minimagick:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A ruby wrapper for ImageMagick or GraphicsMagick command line.

Tested on both Ruby 1.9.2 and Ruby 1.8.7.


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|

…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.

Why the fork?

Simply for the sake of Compositing.

I seen Compositing available in cannikin's fork over at but this was a little outdated when compared to probablycorey's main at

So I combined the two in a very hackety (5 minute) fashion to get the best of both!

I've dumped it hear so I dont lose it and for other if they so wish to use it..


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


Want to make a thumbnail from a file…

image = MiniMagick::Image.from_file("input.jpg")
image.resize "100x100"

Want to make a thumbnail from a blob…

image = MiniMagick::Image.from_blob(blob)
image.resize "100x100"

Need to combine several options?

image = MiniMagick::Image.from_file("input.jpg")
image.combine_options do |c|
  c.sample "50%"
  c.rotate "-90>"

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 ="input.jpg")
image.resize "100x100"

Want to get some meta-information out?

image = MiniMagick::Image.from_file("input.jpg")
image[:width]               # will get the width (you can also use :height and :format)
image["EXIF:BitsPerSample"] # It also can get all the EXIF tags
image["%m:%f %wx%h"]        # Or you can use one of the many options of the format command

For more on the format command see


To create a composite simply call with the images you want composite, the path to the output file and any command line options you may want. Note that the images should be passed in the order you want them stacked (first image is on top, second image is in back). You will be returned a MiniMagick::Image instance for the new composited image:

image1 ='foreground.png')
image2 ='background.png')
output_image =, image2, 'jpg', :gravity => 'NorthEast')

The above example would combine the two images into a new JPEG file and, if the two images are different sizes it will stick the top image into the upper right (north east) corner of the bottom image. The the image is saved using the standard method.

The 'composite' script has several options, see here:


You must have ImageMagick or GraphicsMagick installed.