Thursday, November 10, 2011

mini_magick - A better RMagick alternative

Unfortunately, RMagick has been a vaporware despite new developer had been inherited from former one. There are less activities. So that we should seek its alternative. The better one is mini_magick.

installation

> gem list mini_magick
Successfully installed subexec-0.1.0
Successfully installed mini_magick-3.3

Usage

In short, check readme.

For example for POSIX:
require 'mini_magick'
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"


(Since the end of 2011, we can write the same codes both for POSIX and for Windows. Please check this article.)

For example for Windows:
require 'mini_magick'
MiniMagick.timeout = 42
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"


Because of the bug both in mini_magick and in subexec, the developer using Ruby 1.9.x on Windows should write the mantra MiniMagick.timeout = milliseconds

Next version of mini_magick and subexec

As you see the sources on github, next version of mini_magick and subexec fix bugs for running on Windows. So you can write the same codes both for POSIX and for Windows.

No comments:

Post a Comment