Skip to content

Instantly share code, notes, and snippets.

@makenova
Last active November 3, 2020 22:33
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save makenova/78bb63aaa1050e2ad8019ee1e7e7b433 to your computer and use it in GitHub Desktop.
Save makenova/78bb63aaa1050e2ad8019ee1e7e7b433 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

Note

These notes were for a job I am no longer at and are very dated. Please go to the imagemagick website for updated instructions.

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
@mtkuyucu
Copy link

when i typed this code sudo apt-get build-dep imagemagick -y
I get

E: You must put some 'source' URIs in your sources.list

how can I solve this issue

@PLumowina
Copy link

mtkuyucu: you need to add "deb-src" in /etc/apt/sources.list and then do sudo apt-get update

@Kindra-Serr
Copy link

Kindra-Serr commented Mar 29, 2018

I am also getting the error

E: You must put some 'source' URIs in your sources.list

what is the source that I need to add to sources.list? Is it just the line deb-src?

@dangkhoaow
Copy link

Best place to execute ImageMagick online for you. Supporting all ImageMagick feature with output file and console log, no need to install.
https://freetoolonline.com/imagemagick-online.html

@YarikST
Copy link

YarikST commented Jun 4, 2018

Installing libmagickwand-dev seemed to sort it out.

  1. sudo apt autoremove imagemagick
  2. rm /usr/bin/convert and rm /usr/bin/convert-im6
  3. sudo apt-get install imagemagick
  4. sudo apt-get install libmagickwand-dev

sudo apt install ffmpeg


ImageMagick delegates video processing. I lost more than 5 hours to understand why such a bug NotIdentifiedByImageMagickError


install make https://www.imagemagick.org/discourse-server/viewtopic.php?t=24284

@virtualdvid
Copy link

virtualdvid commented Jul 20, 2018

If you get the error:

E: You must put some 'source' URIs in your sources.list

You'll need to go:

/etc/apt/sources.list

and uncomment

# deb-src

deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted

save the file and run again:

$ sudo apt update
$ sudo apt build-dep imagemagick

@sachinkreeti
Copy link

Hi everyone, It's better to use the official site for installing something.
https://www.imagemagick.org/script/install-source.php

Also instead of running make run checkinstall.
This will ease the process of removing the software in case if something goes wrong.

Read more about checkinstall here
https://help.ubuntu.com/community/CheckInstall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment