Skip to content

Instantly share code, notes, and snippets.

@douglasresende
Forked from makenova/IMfromsource.md
Created April 20, 2018 17:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglasresende/d8b2452eb07d60c64ecbb4e5290ae1d9 to your computer and use it in GitHub Desktop.
Save douglasresende/d8b2452eb07d60c64ecbb4e5290ae1d9 to your computer and use it in GitHub Desktop.
Install ImageMagick from source on Ubuntu 14.04

Install ImageMagick from source on Ubuntu 14.04

The version of ImageMagick that is installed when you run apt-get install imagemagick on Ubuntu 14.04 is older than I would like.

$ convert --version
Version: ImageMagick 6.7.7-10 2016-06-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

To get a more recent version I can either pull down a binary or build from source. The binaries available on the site, found here, are for:

  • Redhat / CentOS 7.1 x86_64 RPM
  • Solaris Sparc 2.11
  • Cygwin
  • MinGW

I'm most comfortable with ubuntu so I'll build from source.

The official installation instructions can be found here I had some trouble getting the png library to work so, these are my notes

  • remove version installed with apt-get
  • install dependencies
  • download ImageMagick source
  • build source
  • install and verify

remove version installed with apt-get

Use the package manager you used to install imagemagick to uninstall it.

# you may not need sudo

sudo apt-get remove imagemagick && sudo apt-get autoremove

install dependencies

  • Install dependencies
sudo apt-get install build-essential
sudo apt-get build-dep imagemagick -y

Some instructions added libpng12-dev and libjpeg-dev but, build-dep covered that. If things don't workout for you, maybe adding them will fix your issue.

download ImageMagick source

wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz

the wget command downloads the latest ImageMagick archive to your current directory and the tar command extracts the files to the same directory.

build source

cd ImageMagick-6.8.9-1/
./configure

When the configuration is finished, scroll up a bit and check that the correct delegate libraries(plugins) were added. I need .jpeg and .png support so I'm going to make sure the rightmost column on their rows said, yes. Here is the relevant section of my output.

Delegate Library Configuration:
  BZLIB             --with-bzlib=yes		yes
  Autotrace         --with-autotrace=no		no
  DJVU              --with-djvu=yes		yes
  DPS               --with-dps=yes		no
  FFTW              --with-fftw=yes		yes
  FLIF              --with-flif=yes		no
  FlashPIX          --with-fpx=yes		no
  FontConfig        --with-fontconfig=yes	yes
  FreeType          --with-freetype=yes		yes
  Ghostscript lib   --with-gslib=no		no
  Graphviz          --with-gvc=yes		no
  JBIG              --with-jbig=yes		yes
  JPEG v1           --with-jpeg=yes		yes
  LCMS              --with-lcms=yes		yes
  LQR               --with-lqr=yes		yes
  LTDL              --with-ltdl=yes		no
  LZMA              --with-lzma=yes		yes
  Magick++          --with-magick-plus-plus=yes	yes
  OpenEXR           --with-openexr=yes		yes
  OpenJP2           --with-openjp2=yes		no
  PANGO             --with-pango=yes		yes
  PERL              --with-perl=no		no
  PNG               --with-png=yes		yes
  RAQM              --with-raqm=yes		no
  RSVG              --with-rsvg=no		no
  TIFF              --with-tiff=yes		yes
  WEBP              --with-webp=yes		no
  WMF               --with-wmf=yes		yes
  X11               --with-x=			yes
  XML               --with-xml=yes		yes
  ZLIB              --with-zlib=yes		yes

if the necessary delegates are not added, you'll need to add those before you build. I'd love to tell you how, but I didn't have to do that so I didn't dig into it.

Compile the source with make.

make

install and verify

sudo make install

convert --version

when running convert --version to confirm installation after make install, I got the following error

convert: error while loading shared libraries: libMagickCore-7.Q16HDRI.so.2: cannot open shared object file: No such file or directory

running sudo ldconfig /user/local/lib cleared it up

convert --version
Version: ImageMagick 7.0.4-7 Q16 x86_64 2017-02-06 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff wmf x xml zlib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment