Building Imagemagick 7.1 with HEIC Support from Source
July 01, 2022 Stardate: 75963.1
Tagged as:
ImageMagick Ubuntu
I upgraded my Ubuntu distro from 20.04 to 22.04 and ImageMagick didn’t come along for the ride… I’m not sure what happened. In this post I build ImageMagick 7.1.0-39 with HEIC support from source on Ubuntu 22.04.
I first installed from the apt package manager (with no errors) but when verifying the installation I got this code:
convert: error while loading shared libraries: libwebp.so.6: cannot open shared object file: No such file or directory
After some Googling around I decided to try building from source with HEIC support as I now have an iPhone from work and would like to use ImageMagick to convert .heic to .jpg. Building from source turned out to be surprisingly easy.
I found a gist from github user Alexandr Evstigneev and made some tweaks to his installation gist .
Here is mine:
# -- Credits --
# copied from https://gist.github.com/hurricup/e14ae5bc47705fca6b1680e7a1fb6580
# which in turn was inspired by https://gist.github.com/rjnienaber/af47fccb8410926ba7ea35f96c3b87fd
# 1. Remove old bundled ImageMagick program
sudo apt remove imagemagick -y
# 1b. Update and install libraries for buidling from source
sudo apt update
sudo apt install build-essential
# 2. Install base dependencies
sudo apt-get install -y \
libde265-dev \
libdjvulibre-dev \
libfftw3-dev \
libghc-bzlib-dev \
libgoogle-perftools-dev \
libgraphviz-dev \
libgs-dev \
libheif-dev \
libjbig-dev \
libjemalloc-dev \
libjpeg-dev \
liblcms2-dev \
liblqr-1-0-dev \
liblzma-dev \
libopenexr-dev \
libpango1.0-dev \
libraqm-dev \
libraw-dev \
libtiff-dev \
libwebp-dev \
libwmf-dev \
libzip-dev \
libzstd-dev
# 3. Install it
git clone --depth 1 --branch 7.1.0-39 https://github.com/ImageMagick/ImageMagick.git
cd ImageMagick
# 4. Configure the installatino
./configure \
--with-bzlib=yes \
--with-djvu=yes \
--with-fftw=yes \
--with-fontconfig=yes \
--with-freetype=yes \
--with-gslib=yes \
--with-gvc=yes \
--with-heic=yes \
--with-jbig=yes \
--with-jemalloc=yes \
--with-jpeg=yes \
--with-lcms=yes \
--with-lqr=yes \
--with-lzma=yes \
--with-magick-plus-plus=yes \
--with-openexr=yes \
--with-openjp2=yes \
--with-pango=yes \
--with-perl=yes \
--with-png=yes \
--with-raqm=yes \
--with-raw=yes \
--with-rsvg=yes \
--with-tcmalloc=yes \
--with-tiff=yes \
--with-webp=yes \
--with-wmf=yes \
--with-x=yes \
--with-xml=yes \
--with-zip=yes \
--with-zlib=yes \
--with-zstd=yes
# 5. Run make install
make -j 8
sudo make install
sudo ldconfig /usr/local/lib
# 6. Last step! Check installation
identify --version
# 7. You should see something like this
# --------------------------------------
# Version: ImageMagick 7.1.0-10 Q16-HDRI x86_64 2021-10-03 https://imagemagick.org
# Copyright: (C) 1999-2021 ImageMagick Studio LLC
# License: https://imagemagick.org/script/license.php
# Features: Cipher DPC HDRI OpenMP(4.5)
# Delegates (built-in): fontconfig freetype heic jp2 png webp x xml zlib
# Compiler: gcc (10.3)
You can obviously run it as a script or if you are timid (like me) you can copy/paste each line and look for errors.
Software Versions
This is an automated list of software versions used during the writing of this article.
Software Version
Ubuntu 20.04 LTS
ImageMagick 7.1.0-39