How can I convert an HEIF/HEIC image into a JPEG? Maybe using ImageMagick?
6 Answers
Support for reading HEIF was added to ImageMagick 7.0.7-22, you have to install it with --with-libheif flag.
e.g. on macOS with Homebrew: brew install imagemagick --with-libheif. If you have previously installed imagemagick with Homebrew, you need to uninstall it by brew uninstall imagemagick first.
One other option to convert HEIF → JPG on macOS is by using Automator. It has a "Change Type of Images" action that can do the conversion. If needed, you could have the "to JPG" conversion available in context menu
- 2,279
- 2
- 28
- 44
- Remove previous version of ImageMagick:
$ sudo apt-get remove imagemagick
- Install base dependencies:
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libx11-dev libxext-dev zlib1g-dev libpng12-dev libjpeg-dev libfreetype6-dev libxml2-dev
$ sudo apt-get install libwebp-dev libde265-dev
$ sudo apt-get install pkg-config m4 libtool automake autoconf
- Install library for reading HEIF/HEIC files (this step is essential):
$ cd /usr/src/
$ sudo wget https://github.com/strukturag/libheif/archive/v1.3.2.tar.gz
$ sudo tar -xvf v1.3.2.tar.gz
$ sudo rm v1.3.2.tar.gz
$ cd libheif-1.3.2/
$ sudo ./autogen.sh
$ sudo ./configure
$ sudo make
$ sudo make install
- Install ImageMagick with WEBP and HEIC support:
$ cd /usr/src/
$ sudo wget http://www.imagemagick.org/download/ImageMagick.tar.gz
$ sudo tar xvzf ImageMagick.tar.gz
$ sudo rm ImageMagick.tar.gz
$ cd ImageMagick-7.0.10-31/
$ sudo ./configure --with-heic=yes --with-webp=yes
$ sudo make
$ sudo make install
$ sudo ldconfig /usr/local/lib
$ sudo make check
- Check version:
$ convert --version
...
Version: ImageMagick 7.0.10-31 Q16 x86_64 2020-10-03 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.0)
Delegates (built-in): bzlib fontconfig freetype heic jbig jng jpeg lcms lzma openexr pangocairo png tiff webp wmf x xml zlib
As you see 'heic' is in the delegates list.
To convert single file from HEIC into JPG:
$ convert IMG_3288.HEIC IMG_3288.JPG
- To convert all HEIC-files in current directory into JPG:
$ ls *.HEIC -1 | sed -e 's/\.HEIC$//' | xargs -I {} convert {}.HEIC {}.JPG
OPTIONALLY: Setting date and time of each JPG-file according to EXIF timestamp:
$ exiftool "-DateTimeOriginal>FileModifyDate" *.JPG
If you don't have exiftool utility you can install it by following command:
$ sudo apt install libimage-exiftool-perl
Usefull links:
https://medium.com/@sanjaywrites/install-latest-version-of-imagemagick-in-ubuntu-16-04-c406ddea1973 https://gist.github.com/rjnienaber/af47fccb8410926ba7ea35f96c3b87fd
-
-
1These instructions are for Linux with Debian package management system (Debian, Ubuntu, Linux Mint, ...) – Ukr May 16 '21 at 07:34
Ubuntu/Linux
filibuntu has written about HEIF software on AskUbuntu. The information likely applies to other Linux distributions as well.
libheif-examplescontains command-line utilities:heif-encandheif-convert.GIMP and Krita support HEIF via libheif.
Recent Geeqie git commits have added HEIF support. It may be installed from PPA.
Imagemagick can be recompiled with
libheifsupport. There also do not appear to be any pre-built packages for Debian/Ubuntu.
Windows 10
Windows 10 Build 17623 includes support for HEIF in the Photos app.
The following may need to be installed:
Online Converters
Google Photos and Dropbox have been reported to support HEIF.
There are other converters, but be sure to read their privacy policies before using them.
- 26,951
- 4
- 39
- 126
-
i noticed today that i was able to open a
.heicimage taken on an iPhone in google classroom, so i'd assume the entire g-suite now supports it – DeveloperACE May 01 '19 at 02:16
On Windows 7 have used free batch converter Converseen to convert HEIC to JPG. Retains EXIF. http://converseen.fasterland.net/
- 11
- 1
On Windows, with recent ImageMagick, all I had to do from a command window was:
magick mogrify -format jpg *.HEIC
to convert all the HEIC files in a folder to .jpg. No batch or scripts needed.
- 11
- 2
my two cents... I was tired of using cmd line...
I wrote a small app... if interested. it's free:
https://apps.apple.com/us/app/heictojpeg/id1486256731?ls=1&mt=12
hope can be useful
- 101
- 1
brew reinstallwith the libheif option didn't work for me. And it seems documented as such inbrew help reinstall: "Uninstall and then install formula (with existing install options)." However,brew uninstall imagemagick+brew install imagemagick --with-libheifworked just fine! Upvoting, but might be worth an update. – jleverenz Dec 18 '18 at 01:09imagemagickhaslibheifinbuilt. So when you try to update an older version withbrew install imagemagick --with-libheif, you might receive an error such as :Error: invalid option: --with-libheifSimply run
– mastef Mar 28 '19 at 04:26brew install imagemagickand it will install an imagemagic version that has libheif built-in.