A graphicsmagick binding to add support for additional image formats to prawn.



gem "prawn-gmagick"

Your code

require "prawn/gmagick"

Supported Image Formats

prawn-gmagick will try to load any image passed to it that graphicsmagick can identify. To see what formats your installation supports run gm version.


In an unscientific speed test using this PNG image on my MacBook Pro, prawn-gmagick shows a noticeable speed improvement over Prawn and comparable speed to prawn-fast-png.

# Using prawn 0.12.0
$ time ruby png_example.rb
ruby png_example.rb  44.70s user 1.75s system 99% cpu 46.663 total

# Using prawn 0.12.0 with prawn-fast-png
$ time ruby png_example.rb
ruby png_example.rb  1.08s user 0.17s system 99% cpu 1.254 total

# Using prawn 0.13.1
$ time ruby png_example.rb
ruby png_example.rb  5.18s user 0.16s system 97% cpu 5.472 total

# Using prawn 0.13.1 with prawn-gmagick
$ time ruby png_example.rb
ruby png_example.rb  1.17s user 0.20s system 93% cpu 1.463 total

Amazon EC2 / Elastic Beanstalk Installation

To allow the gem to install successfuly, you may need to run some (or all) of the following commands on your EC2 instance:

sudo yum install GraphicsMagick
sudo yum install GraphicsMagick-c++
sudo yum install GraphicsMagick-devel

For an Elastic Beanstalk deployment you will need to create an .ebextensions\packages.config file, add the following and then commit it to git:

    GraphicsMagick: []
    GraphicsMagick-c++: []
    GraphicsMagick-devel: []

Found a bug?

Open a github issue

Contributing & Development

  1. Fork the project.
  2. Make your feature addition or bug fix. All specs should pass.
  3. Add specs for your changes.
  4. Commit
  5. Send a pull request. Bonus points for topic branches.


prawn-gmagick is released under the MIT Licence


prawn-gmagick is written and maintained by Evan Sharp.