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.
libheif-examplespackage contains tools, among whichheif-convertcan convert HEIF to JPG (or PNG). Its only option is quality of output, but you may chain it with imagemagick...