Convert HEIC to JPG from the commandline

By default pictures taken from an iPhone are stored in HEIC format. I find that most of the systems I interact with do not support HEIC. Converting a large number of photos is tedious with the traditional GUI applications.

ImageMagick has the mogrify command line tool to quickly batch convert any number of files with a single command. ImageMagick is not installed by default. Use brew to install if necessary: brew install imagemagick.

Files copied with AirDrop off an iPhone:

[email protected]:~/Downloads $ ls -al IMG_0956.HEIC IMG_0957.HEIC IMG_0954.HEIC IMG_0953.HEIC IMG_0951.HEIC IMG_0950.HEIC IMG_0949.HEIC IMG_0948.HEIC IMG_0946.HEIC
[email protected] 1 jemurray  access_bpf  1526912 Sep 23 16:42 IMG_0946.HEIC
[email protected] 1 jemurray  access_bpf  2446142 Sep 23 16:43 IMG_0948.HEIC
[email protected] 1 jemurray  access_bpf  1351051 Sep 23 16:43 IMG_0949.HEIC
[email protected] 1 jemurray  access_bpf  1527961 Sep 23 16:43 IMG_0950.HEIC
[email protected] 1 jemurray  access_bpf  1433100 Sep 23 16:44 IMG_0951.HEIC
[email protected] 1 jemurray  access_bpf  2107683 Sep 23 16:45 IMG_0953.HEIC
[email protected] 1 jemurray  access_bpf  1804572 Sep 23 16:45 IMG_0954.HEIC
[email protected] 1 jemurray  access_bpf  1725539 Sep 23 16:47 IMG_0956.HEIC
[email protected] 1 jemurray  access_bpf  1642674 Sep 23 16:47 IMG_0957.HEIC

Use the mogrify command to convert the images from HEIC to JPG:

[email protected]:~/Downloads $ mogrify -format jpg IMG_0956.HEIC IMG_0957.HEIC IMG_0954.HEIC IMG_0953.HEIC IMG_0951.HEIC IMG_0950.HEIC IMG_0949.HEIC IMG_0948.HEIC IMG_0946.HEIC

When the conversion is complete, both the HEIC and JPG format images are available:

[email protected]:~/Downloads $ ls -alt 
total 111213776
[email protected]   1 jemurray  staff          2469609 Sep 23 17:09 IMG_0946.jpg
[email protected] 544 jemurray  staff            17408 Sep 23 17:09 .
[email protected]   1 jemurray  staff          3373659 Sep 23 17:09 IMG_0948.jpg
[email protected]   1 jemurray  staff          2345537 Sep 23 17:09 IMG_0949.jpg
[email protected]   1 jemurray  staff          2743936 Sep 23 17:09 IMG_0950.jpg
[email protected]   1 jemurray  staff          2497650 Sep 23 17:09 IMG_0951.jpg
[email protected]   1 jemurray  staff          2844725 Sep 23 17:09 IMG_0953.jpg
[email protected]   1 jemurray  staff          2743487 Sep 23 17:09 IMG_0954.jpg
[email protected]   1 jemurray  staff          2694978 Sep 23 17:09 IMG_0957.jpg
[email protected]   1 jemurray  staff          2878063 Sep 23 17:09 IMG_0956.jpg
[email protected]   1 jemurray  access_bpf     1725539 Sep 23 16:47 IMG_0956.HEIC
[email protected]   1 jemurray  access_bpf     1642674 Sep 23 16:47 IMG_0957.HEIC
[email protected]   1 jemurray  access_bpf     1804572 Sep 23 16:45 IMG_0954.HEIC
[email protected]   1 jemurray  access_bpf     2107683 Sep 23 16:45 IMG_0953.HEIC
[email protected]   1 jemurray  access_bpf     1433100 Sep 23 16:44 IMG_0951.HEIC
[email protected]   1 jemurray  access_bpf     1527961 Sep 23 16:43 IMG_0950.HEIC
[email protected]   1 jemurray  access_bpf     1351051 Sep 23 16:43 IMG_0949.HEIC
[email protected]   1 jemurray  access_bpf     2446142 Sep 23 16:43 IMG_0948.HEIC
[email protected]   1 jemurray  access_bpf     1526912 Sep 23 16:42 IMG_0946.HEIC

comments powered by Disqus