praaveen
Published in

praaveen

Compiling imagemagick with HEIC support in ubuntu

HEIC is a image format, which is supported by iOS, and will be used exclusively by iOS.

When working with ruby on rails, we get into the situation to allow upload option to accept the HEIC image,so people can upload from their iphone.

Sample HEIC images and preview

Compiling imagemagick with HEIC support in heroku(ubuntu)

`convert #{path} #{directory}#{jpegname}`

Error


convert: no decode delegate for this image format `HEIC' @ error/constitute.c/ReadImage/501.
convert: no images defined `image.jpg' @ error/convert.c/ConvertImageCommand/3210.

Could n’t find the library for heic files. We can check that by getting into ImageMagick folder. ex : ImageMagick-7.0.11–14

./configure — with-modulesDelegate 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=no no
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
HEIC --with-heic=yes no
JBIG --with-jbig=yes yes
JPEG v1 --with-jpeg=yes yes
JPEG XL --with-jxl=no no
LCMS --with-lcms=yes yes
LQR --with-lqr=yes yes
LTDL --with-ltdl=yes yes
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
RAW --with-raw=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes yes
WEBP --with-webp=yes yes
WMF --with-wmf=yes yes
X11 --with-x= yes
XML --with-xml=yes yes
ZIP --with-zip=yes no
ZLIB --with-zlib=yes yes
ZSTD --with-zstd=yes no

type : HEIC
option : with-heic=yes
value : no

convert -versionVersion: ImageMagick 7.0.11-14 Q16 x86_64 2021-05-31 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): bzlib djvu fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff webp x xml zlib

Delegates (built-in): bzlib djvu fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff webp x xml zlib

Delegates list the configured types.

Solution :
Compiling imagemagick with HEIC support from clean install of Ubuntu

$ sudo sed -Ei ‘s/^# deb-src /deb-src /’ /etc/apt/sources.list
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf git-core
$ 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
$ cd /usr/src/
$ sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz
$ sudo tar xf ImageMagick.tar.gz
$ cd ImageMagick-7*
$ sudo ./configure — with-heic=yes
$ sudo make –j4
$ sudo make install
$ sudo ldconfig

$ mogrify — version
# heic should appear in the Delegates line

After above steps try
Version

$ convert -version
Version: ImageMagick 7.0.11–14 Q16 x86_64 2021–05–31 https://imagemagick.org
Copyright: © 1999–2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib djvu fontconfig freetype heic jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff webp x xml zlib

Configuration

./configure — with-modulesDelegate 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=no no
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
HEIC --with-heic=yes yes
JBIG --with-jbig=yes yes
JPEG v1 --with-jpeg=yes yes
JPEG XL --with-jxl=no no
LCMS --with-lcms=yes yes
LQR --with-lqr=yes yes
LTDL --with-ltdl=yes yes
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
RAW --with-raw=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes yes
WEBP --with-webp=yes yes
WMF --with-wmf=yes yes
X11 --with-x= yes
XML --with-xml=yes yes
ZIP --with-zip=yes no
ZLIB --with-zlib=yes yes
ZSTD --with-zstd=yes no

Reference :
https://askubuntu.com/questions/1131996/problems-with-compiling-imagemagick-with-heic?rq=1

https://www.everclimb.co/blog/how-to-install-imagemagick-7-on-ubuntu-16-04

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store