Skip to content
Ruby bindings for ImageMagick
C Ruby Shell
Pull request Compare This branch is 334 commits ahead of rmagick-temp:master.
Latest commit d343a9d Jun 22, 2016 @vassilevsky vassilevsky Add proper headings
Failed to load latest commit information.
deprecated Remove all require_relatives Dec 5, 2014
doc Update docs for get_type_metrics Jan 26, 2016
examples Manually remove indentation of `when` inside `case` Feb 26, 2015
ext/RMagick Automatically set `CPPFLAGS` and `LDFLAGS` on MinGW Aug 6, 2015
lib Remove unused local variable May 29, 2016
spec more tests converted to RSpec Aug 6, 2015
test more tests converted to RSpec Aug 6, 2015
.editorconfig Add .editorconfig to make a default indentation style Jul 24, 2015
.gitignore Add missing image with ICC profile Aug 1, 2014
.hound.yml Add Hound configuration that uses existing RuboCop config file Feb 16, 2015
.rspec introduce rspec and convert over draw_spec.rb Apr 27, 2015
.rubocop.yml update rubocop config Aug 5, 2015
.simplecov Add SimpleCov Dec 5, 2014
.travis.yml remove style checks from Travis build Aug 8, 2015
CHANGELOG.md Release version 2.15.4 Aug 14, 2015
CODE_OF_CONDUCT.md Make source information italic Apr 14, 2015
CONTRIBUTING.md Document the problem with the default repo when creating a PR Aug 14, 2015
Doxyfile Migrated comments to Doxygen-style comments, added Doxyfile for auto-… Dec 20, 2009
Gemfile Add SimpleCov Dec 5, 2014
LICENSE Add MIT license May 10, 2013
README.textile Add proper headings Jun 22, 2016
Rakefile introduce rspec and convert over draw_spec.rb Apr 27, 2015
before_install_linux.sh Download Imagemagick as a tar.xz Jul 23, 2015
before_install_osx.sh Use different before_install scripts for different OSes Oct 21, 2014
rmagick.gemspec update rubocop config Aug 5, 2015

README.textile

RMagick

RubyGems VersionEye Travis CI Code Climate Gitter

Table of Contents

Introduction

RMagick is an interface between the Ruby programming language and the
ImageMagick image processing library.

Prerequisites

O/S Linux, *BSD, OS X, Windows 2000, XP, Vista, other *nix-like systems.

Ruby Version 1.8.5 or later. You can get Ruby from www.ruby-lang.org.

Ruby must be able to build C-Extensions (e.g. MRI, Rubinius, not JRuby)

ImageMagick Version 6.4.9 or later. You can get ImageMagick from www.imagemagick.org.

On Ubuntu, you can run:

sudo apt-get install libmagickwand-dev

Note to Windows users: Please make sure that you choose an ImageMagick version that matches the bitness of your Ruby version.

Installing RMagick

Installing via Bundler

Add to your `Gemfile`:

gem 'rmagick'

Then run:

bundle install

Installing via RubyGems

Run:

gem install rmagick

Versioning

RMagick is versioned according to Semantic Versioning.
For stable version compatible with Ruby 1.8+, use `~> 2.0`.
Upcoming version 3 will work on Ruby 2.x only.

Using RMagick

Require RMagick in your project as follows:

require 'rmagick'

Things that can go wrong

The RMagick installation FAQ
has answers to the most commonly reported problems, though may be out of date.

Can’t install RMagick. Can’t find libMagick or one of the dependent libraries. Check the mkmf.log file for more detailed information.

Typically this message means that one or more of the libraries that ImageMagick
depends on hasn’t been installed. Examine the mkmf.log file in the ext/RMagick
subdirectory of the installation directory for any error messages. These messages
typically contain enough additional information for you to be able to diagnose
the problem. Also see this FAQ.

On OS X with Homebrew, try [re]installing pkg-config:

brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config
brew link pkg-config

Cannot open shared object file

If you get a message like this:

    $DIR/RMagick.rb:11:in `require': libMagick.so.0:
      cannot open shared object file: No such file or directory -
      $DIR/RMagick2.so (LoadError)

you probably do not have the directory in which the ImageMagick library
is installed in your load path. An easy way to fix this is to define
the directory in the LD_LIBRARY_PATH environment variable. For
example, suppose you installed the ImageMagick library libMagick.so in
/usr/local/lib. (By default this is where it is installed.) Create the
LD_LIBRARY_PATH variable like this:

        export LD_LIBRARY_PATH=/usr/local/lib

On Linux, see ld(1) and ld.so(8) for more information. On other operating
systems, see the documentation for the dynamic loading facility.

Segmentation fault

Default stack size of your operating system might be too small. Try removing the limit with this command:

        ulimit -s unlimited

Upgrading

If you upgrade to a newer release of ImageMagick, make sure you’re using a
release of RMagick that supports that release. It’s safe to install a new
release of RMagick over an earlier release.

More samples

You can find more sample RMagick programs in the /example directory.
These programs are not installed in the RMagick documentation tree.

Reporting bugs

Please report bugs in RMagick, its documentation, or its installation
programs to me via the bug tracker on the RMagick issues page

However, I can’t help with Ruby installation and configuration or ImageMagick
installation and configuration. Information about reporting problems and
getting help for ImageMagick is available at the ImageMagick web site
or the ImageMagick Forum.

Development Setup

In order to minimize issues on your local machine, we recommend that you make
use of a Vagrant installation.

Steps to get up and running with a passing build are as follows:

1) set up the Vagrant environment

If you don’t already have Vagrant installed, you can download and install it
from here. Once installed, we can set up a pre-built environment:

git clone https://github.com/tjschuck/rake-compiler-dev-box.git
cd rake-compiler-dev-box
vagrant up

This last part will probably take a while as it has to download an Ubuntu image
and configure it. If there is an error during this process, you may need to
reboot your computer and enable virtualization in your BIOS settings.

2) clone RMagick and log in to the vagrant box

Within the `rake-compiler-dev-box` directory:

git clone https://github.com/rmagick/rmagick.git # or your fork
vagrant ssh

3) install ImageMagick and additional environment stuff

cd /vagrant/rmagick
export IMAGEMAGICK_VERSION=6.6.9-10 # the only known passing version as of this writing
sh ./before_install_linux.sh

This will take just a few minutes to build ImageMagick

4) build RMagick

rake

This compiles the RMagick extensions and runs the tests. If all goes well
you’ll see a lot of output, eventually ending in something like:

Finished tests in 35.865734s, 11.3758 tests/s, 6560.3007 assertions/s.

408 tests, 235290 assertions, 0 failures, 0 errors, 0 skips

And you’re all set! The copy of RMagick within `/vagrant/rmagick` inside your
Vagrant session is the same as the one in the `rake-compiler-dev-box` directory
on your machine. You can make changes locally and run tests within your `ssh`
session.

Contact Information

Author: Tim Hunter, Omer Bar-or, Benjamin Thomas

Credits

Thanks to ImageMagick Studio LLC for ImageMagick
and for hosting the RMagick documentation.

MIT License

Copyright © 2002-2009 by Timothy P. Hunter

Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Releasing

See https://github.com/rmagick/rmagick/wiki/Release-Process

  1. Update ChangeLog
  2. Edit lib/rmagick/version.rb
  3. Are the tests passing? Run `rake` again just to be sure.
  4. `rake release`
Something went wrong with that request. Please try again.