14

How can I convert an HEIF/HEIC image into a JPEG? Maybe using ImageMagick?

11

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

| improve this answer | |
  • FYI. It is possible to change the settings in your iPhone to capture photos as JPEG‘s instead of HEIF so that you don’t have to deal with their very compressed files. Go to settings> camera> formats and choose most compatible. Another option is to use a third-party app that saves Photos as tiff or raw and avoid compression altogether – Alaska Man Jun 16 '18 at 18:09
  • Sure, but of course you would lose all other perks in addition to the improved compression (e.g. depth maps for portrait photos) as well. Not saying either is better, but that both have drawbacks which are subject to personal preferences. – Jari Keinänen Jun 16 '18 at 18:22
  • Those things are not important to me and i prefer have complete control over my images and not let the software choose what data to delete when it compresses. If they are important to you then you can have both. The app i use can be set to save both raw and HEIF ( or JPG ) – Alaska Man Jun 16 '18 at 18:29
  • 2
    brew reinstall with the libheif option didn't work for me. And it seems documented as such in brew help reinstall: "Uninstall and then install formula (with existing install options)." However, brew uninstall imagemagick + brew install imagemagick --with-libheif worked just fine! Upvoting, but might be worth an update. – jleverenz Dec 18 '18 at 1:09
  • 5
    In recent versions homebrew's imagemagick has libheif inbuilt. So when you try to update an older version with brew install imagemagick --with-libheif, you might receive an error such as : Error: invalid option: --with-libheif Simply run brew install imagemagick and it will install an imagemagic version that has libheif built-in. – Markus Stefanko Mar 28 '19 at 4:26
2

Ubuntu/Linux

  • filibuntu has written about HEIF software on AskUbuntu. The information likely applies to other Linux distributions as well.

  • libheif-examples contains command-line utilities: heif-enc and heif-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 libheif support. There also do not appear to be any pre-built packages for Debian/Ubuntu.

Windows 10

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.

| improve this answer | |
  • i noticed today that i was able to open a .heic image taken on an iPhone in google classroom, so i'd assume the entire g-suite now supports it – DeveloperACE May 1 '19 at 2:16
1

On Windows 7 have used free batch converter Converseen to convert HEIC to JPG. Retains EXIF. http://converseen.fasterland.net/

| improve this answer | |
1
  1. Remove previous version of ImageMagick:
$ sudo apt-get remove imagemagick
  1. 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
  1. 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
  1. 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
  1. 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
  1. As you see 'heic' is in the delegates list.

  2. To convert single file from HEIC into JPG:

$ convert IMG_3288.HEIC IMG_3288.JPG
  1. 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

| improve this answer | |
0

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.