3

I can't get a straight answer to the following simple questions:

  1. GENERAL CASE: how do you install an application via apt-get compiled with an optional library?
  2. SPECIFIC CASE: I want to install imagemagick with the libheif option so that I can use it to convert .heic files to e.g. .jpg. What is the exact apt-get syntax to achieve this? With homebrew you just add --with-libheif, but I don't know what the debian convention is.

(I'm working on Raspbian GNU/Linux 9 (stretch)).

1
  • On Linux Mint 19 (Ubuntu clone, quite similar to Debian), the libheif-examples package contains tools, among which heif-convert can convert HEIF to JPG (or PNG). Its only option is quality of output, but you may chain it with imagemagick... Commented Jan 4, 2021 at 8:47

1 Answer 1

6

The libheif and libheif-dev packages are not available for Debian Stretch. They are available for Buster but they are still in testing and not officially supported. As a result of this, installing imagemagick via apt will not provide conversion of heic files.

If you want to convert .heic files to another format such as .jpeg then you will need to compile imagemagick from source. First, get the code for libheic from here and compile it with the standard options:

https://github.com/strukturag/libheif/archive/v1.3.2.tar.gz

You can get Imagemagick here:

https://github.com/ImageMagick/ImageMagick/archive/7.0.8-23.tar.gz

To get it to compile properly, I had to set the following variables:

export CFLAGS=-I/path/to/libheif/1.3.2/include
export LDFLAGS=-L/path/to/libheif/1.3.2/lib
export PKG_CONFIG_PATH=/path/to/libheif/1.3.2/lib/pkgconfig

I also previously added the bin and lib directores of libheif to my respective PATH and LD_LIBRARY_PATH although it didn't work which is why I did the above.

I then ran configure with these options:

./configure --prefix=/path/to/imagemagick --with-heic=yes

Imagemagick will then compile with heic support. I was able to convert a .heic image to .jpeg afterwards with no issues.

3
  • Thanks for the thorough answer. To the general question; if those packages had been available for debian stretch, what would have been the syntax to install a build of imagemagick that incorporates those packages? Commented Jan 6, 2019 at 4:52
  • @Anastasius Vivaldus That would depend on how the package was built. The libraries for heic might have already been included or it might have been necessary to install them via apt separately. Either way, the functionality for the Imagemagick package from the Debian reops to recognize and convert would be available so it and the libheif package(if necessary) would just be installed via apt. Commented Jan 6, 2019 at 5:19
  • This worked for me (RHEL7). Paths for CFLAGS, LDFLAGS were in /usr/local/include and /usr/local/lib. Commented Feb 28, 2019 at 13:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.