How to install GraphicsMagick with PNG support on Amazon EC2?

Domenic picture Domenic · Jun 25, 2012 · Viewed 8.4k times · Source

If you naively follow the steps on the GraphicsMagick website, after running ./configure, you end up with no PNG support:

checking for PNG support ...
checking png.h usability... no
checking png.h presence... no

PNG               --with-png=yes        no

This makes for a pretty useless GraphicsMagick instalation.

How can I enable PNG support? Libpng seems to be installed already, but not detected:

> $ sudo yum install libpng
> Package 2:libpng-1.2.49-1.12.amzn1.x86_64 already installed and latest version

Answer

Domenic picture Domenic · Jun 25, 2012

You need to install the libpng-devel package, in addition to just libpng:

sudo yum install libpng-devel

Then when you run ./configure, everything will work out as you'd hope:

checking for PNG support ...
checking png.h usability... yes
checking png.h presence... yes

PNG               --with-png=yes        yes (-lpng12)

<Rant>This is why everything should be available in packages that clearly specify their dependencies and are easily installed with package managers, instead of requiring arcane knowledge of compilation prerequisites.</Rant>