How to install delegate libraries for Image Magick 7.0.7

Solution 1:

It looks like you have simply skipped some of the required Bionic Beaver development libraries. Once these are installed you should be good to go!

1. 'Development' Files:

Easiest way to generate the required list of development libraries is to make sure you have the 'Sources' box ticked in 'Software & Updates' and then run the following command from a Terminal:

apt-get -s build-dep imagemagick

This simulated run (-s) will give you an eye-watering number of files to install (240mb download on a clean Bionic Beaver install). I have done this already for you so simply run the following single command to load up the required development files:

sudo apt-get install autoconf automake autopoint autotools-dev build-essential chrpath \
cm-super-minimal debhelper dh-autoreconf dh-exec dh-strip-nondeterminism doxygen \
doxygen-latex dpkg-dev fonts-lmodern g++ g++-7 gcc gcc-7 gir1.2-harfbuzz-0.0 graphviz \
icu-devtools libann0 libasan4 libatomic1 libbz2-dev libc-dev-bin libc6-dev \
libcairo-script-interpreter2 libcairo2-dev libcdt5 libcgraph6 libcilkrts5 \
libclang1-6.0 libdjvulibre-dev libexif-dev libexpat1-dev libfftw3-bin libfftw3-dev \
libfftw3-long3 libfftw3-quad3 libfile-stripnondeterminism-perl libfontconfig1-dev \
libfreetype6-dev libgcc-7-dev libgdk-pixbuf2.0-dev libglib2.0-dev libglib2.0-dev-bin \
libgraphite2-dev libgts-0.7-5 libgvc6 libgvpr2 libharfbuzz-dev libharfbuzz-gobject0 \
libice-dev libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libilmbase-dev \
libitm1 libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev liblab-gamut1 \
liblcms2-dev liblqr-1-0-dev liblsan0 libltdl-dev liblzma-dev libmime-charset-perl \
libmpx2 libopenexr-dev libpango1.0-dev libpathplan4 libpcre16-3 libpcre3-dev \
libpcre32-3 libpcrecpp0v5 libperl-dev libpixman-1-dev libpng-dev libpotrace0 \
libptexenc1 libpthread-stubs0-dev libpython-stdlib libquadmath0 librsvg2-bin \
librsvg2-dev libsigsegv2 libsm-dev libsombok3 libstdc++-7-dev libsynctex1 \
libtexlua52 libtexluajit2 libtiff-dev libtiff5-dev libtiffxx5 libtool libtool-bin \
libtsan0 libubsan0 libunicode-linebreak-perl libwmf-dev libx11-dev libxau-dev \
libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxdmcp-dev libxext-dev libxft-dev \
libxml2-dev libxml2-utils libxrender-dev libxt-dev libzzip-0-13 linux-libc-dev m4 \
make pkg-config pkg-kde-tools po-debconf preview-latex-style python python-minimal \
python2.7 python2.7-minimal python3-distutils python3-lib2to3 tex-common \
texlive-base texlive-binaries texlive-extra-utils texlive-font-utils \
texlive-fonts-recommended texlive-latex-base texlive-latex-extra \
texlive-latex-recommended texlive-pictures x11proto-core-dev x11proto-dev \
x11proto-xext-dev xorg-sgml-doctools xsltproc xtrans-dev zlib1g-dev

On top of these development files we can add a few more to round out the ImageMagick installation, checkinstall to assist in packaging and a few more -dev files to build some delegates not seen in the standard Ubuntu package. The following is again a single command:

sudo apt-get install checkinstall libwebp-dev libopenjp2-7-dev librsvg2-dev \
libde265-dev libheif-dev

2. Download , compile & install:

Then run the following single command to download the latest ImageMagick and successfully build it:

mkdir $HOME/imagemagick_build && cd $HOME/imagemagick_build && \
wget https://www.imagemagick.org/download/ImageMagick-7.0.7-37.tar.bz2 && \
tar xvf ImageMagick-7.0.7-37.tar.bz2 && cd ImageMagick-7.0.7-37 && \
./configure --with-rsvg && make && \
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/imagemagick_build" \
     --pkgname imagemagick --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
     --pkgversion "7.0.7-37" && \
make distclean && sudo ldconfig

Where I have indicated: ./configure --with-rsvg && make you can substantially speed up the compile by adding something like the following: ./configure --with-rsvg && make -j 4, adding in an integer commensurate with the number of cores available from your processor...

3. Test the installation:

Testing this version reveals your required delegates safely installed:

andrew@ilium:~$ identify --version
Version: ImageMagick 7.0.7-37 Q16 x86_64 2018-06-01 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype heic jbig jng 
jp2 jpeg lcms lqr lzma openexr pangocairo png rsvg tiff webp wmf x xml zlib
andrew@ilium:~$

And now you have the very latest ImageMagick installed on Bionic Beaver with all of the delegates that you required and a few extra ones for good measure:).

Solution 2:

I had the same problem with my ImageMagick install and used andrew.46's really helpful answer above as the basis of my solution.

Andrew's solution failed for me at the make stage as the .heic delegate package didn't compile correctly, causing the whole process to fail. There are two solutions if this happens to you - compile without .heic support if you don't need to use iphone images, or install the necessary packages for the heic delegate package.

1 'Development' files

Exactly follow andrew.46 answer above.

2 Optional - Download packages to compile .heic delegate

I used the answer here as the basis for my solution. You need to install the libde265 and libheif packages.

$ sudo apt-get build-dep imagemagick libde265 libheif
$ cd /usr/src/ 
$ sudo git clone https://github.com/strukturag/libde265.git  
$ sudo git clone https://github.com/strukturag/libheif.git 
$ cd libde265/ 
$ sudo ./autogen.sh 
$ sudo ./configure 
$ sudo make –j4  
$ sudo make install 
$ cd /usr/src/libheif/ 
$ sudo ./autogen.sh 
$ sudo ./configure 
$ sudo make –j4  
$ sudo make install

3 Download, compile and install

You can break the commands in andrew's answer to smaller chunks to see what's going on if helpful. Just run parts of the command in between `&&' speperately. (I didn't actually realise you could use && to join terminal commands together - it's a trick I'm going to use a lot more now.)

The following worked for me:

$ mkdir $HOME/imagemagick_build && cd $HOME/imagemagick_build
$ wget https://www.imagemagick.org/download/ImageMagick.tar.gz
$ tar xvf ImageMagick-7*
$ ./configure --with-rsvg
$ make -j4
$ sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/imagemagick_build" \
     --pkgname imagemagick --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
     --pkgversion "7.0.10-14"
$ make distclean && sudo ldconfig

Note that this should work with the latest version of ImageMagick (just make sure you replace `--pkgversion "7.0.10-14" with whatever version you've downloaded.

If you didn't follow step 2 above, you have to configure ImageMagick without the heic delegate. Just run ./configure --with-rsvg --with-heic=no and you won't have .heic delegate but the compilation will work.

4 verify version

type identify -version in the terminal to check the install. You should have the full list of delegates.

$ identify -version
Version: ImageMagick 7.0.10-14 Q16 x86_64 2020-05-24 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5) 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr lzma openexr pangocairo png rsvg tiff webp wmf x xml zlib

Solution 3:

The approach suggested by @andrew-46 is fine, it was useful to understand how Install ImageMagick with delegates on Ubuntu 20.04

I know that the answer was related to 18.04 but maybe can be useful for someone else.

In particular my goal was to install it into a docker image, this is how I did:

# Install ImageMagick build dependencies
RUN apt-get update -qq &&\
  apt-get install -y -qq \
  chrpath debhelper dh-exec dpkg-dev g++ ghostscript gsfonts libbz2-dev \
  libdjvulibre-dev libexif-dev libfftw3-dev libfontconfig1-dev libfreetype6-dev \
  libjpeg-dev liblcms2-dev liblqr-1-0-dev libltdl-dev liblzma-dev libopenexr-dev \
  libpango1.0-dev libperl-dev libpng-dev librsvg2-bin librsvg2-dev libtiff-dev libwebp-dev \
  libwmf-dev libx11-dev libxext-dev libxml2-dev libxt-dev pkg-config pkg-kde-tools zlib1g-dev
# Install ImageMagick Platform-independent build dependencies
RUN apt-get update -qq &&\
  apt-get install -y -qq \
  doxygen doxygen-latex graphviz jdupes libxml2-utils xsltproc
# Install and Configure ImageMagick
RUN wget https://download.imagemagick.org/ImageMagick/download/ImageMagick-7.1.0-4.tar.gz -P /opt
RUN tar -xvzf /opt/ImageMagick-7.1.0-4.tar.gz -C /opt
RUN /opt/ImageMagick-7.1.0-4/configure --with-modules --enable-shared
RUN make -j 2 /opt/ImageMagick-7.1.0-4
RUN make install /opt/ImageMagick-7.1.0-4/
RUN make distclean
RUN ldconfig /usr/local/lib
RUN rm /opt/ImageMagick-7.1.0-4.tar.gz

I found dependencies list here https://launchpad.net/ubuntu/focal/+source/imagemagick