ImageMagick + rmagick + unknown format: png

Recently I ran into a problem with ImageMagick, rmagick and my Rails application. Somehow my environment was messy and it included varied versions of ImageMagick. This is what I did to solve the problem:

1. Removed all installations of ImageMagick

There was one version that was compiled and installed. I uninstalled it doing this:

# go to wherever you have your make file

cd /usr/local/ImageMagick-6.4.9-4

# run make uninstall with sudo, this rollbacks make install

sudo make uninstall

There was another version that was installed using yum. I uninstalled it doing this:

sudo yum erase ImageMagick

2. Removed all ImageMagick directories from my environment, like this:

I had to repeat the following step a couple of times with different directories:

# you must have root privileges

# this updates the filesystem database to use locate

updatedb

# this finds whatever files/directories have ImageMagick in it

locate ImageMagick

# this gets rid of the ImageMagick library (which wasn’t getting used, anyway..)

sudo rm -r /usr/local/lib/ImageMagick-6.4.9

Basically I got rid of all the unnecessary ImageMagick directories (since I had already uninstalled ImageMagick)

3. Installed libpng using yum:

sudo yum install libpng

4. Installed ImageMagick-devel using yum:

Before I did this, I tried to install rmagick’s gem. (just for the fun of it)

That didn’t work because rmagick didn’t find ImageMagick in the environment.

sudo yum install Magick-devel

5. Installed rmagick

sudo gem install rmagick

6. Restarted my application

I don’t know if this step was necessary, but I did it anyway.

That solved the “unknown format: png” error that I was getting. In days like today I love yum.

This entry was posted in developer tools, linux/unix world and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free