22

Is there a quick and easy way to convert many HEIC files to png on macOS?

Example

Suppose we take some live photos on iPhone, airdrop them to MacBook, and we want to upload them to a site that only accepts .png files.

enter image description here

I've noticed if you simply change the extension from .HEIC to .png (e.g. in the above image), then as far as I can tell, the image file is treated accordingly by programs and it 'works'.

However, I guess the underlying file hasn't changed, so it could still contain live photo information (I think), which a normal png wouldn't have, which, in a worst case, could be a security risk or in less severe cases simply be an annoyance.

What I know so far

The best I can do right now is go through the files one by one renaming them. I would really like to know what other solutions are available (via point and click and terminal), and have a strong preference for not having to download any external software.

0

4 Answers 4

14

As of macOS Monterey, there's a new Quick Action in Finder called "Convert Image". This will create new files based on the original images, but with the format and size changed.

You can select all the images files you want, including HEIC images, and Ctrl-click and choose Quick Actions > Convert Image. Then you'll get this dialog:

enter image description here

enter image description here

Super simple to convert these from Finder now.

3
  • 1
    Great to see this feature! It's probably a good idea to experiment on a few photos you don't care about before using, just to make sure it gives the desired results, as some conversions may be one-way only, for example live photo -> jpeg (cannot be reversed back to live-photo).
    – stevec
    Jun 14, 2023 at 16:45
  • 1
    @stevec good instinct to be cautious, but note that this feature does not overwrite the .HEIC files, but leaves them intact and creates a separate batch of .jpeg files.
    – Stew
    Jul 27, 2023 at 15:26
  • Good point, I've added that info to the answer now.
    – Nick K9
    Jul 28, 2023 at 23:13
29

To convert all .HEIC images in a directory to .png

Open terminal. cd to the directory where the .HEIC files you want to convert are stored.

Be careful, this will convert all .HEIC files in the directory - back them up first if you're not sure you want to do that just yet.

for f in *.HEIC
do sips -s format png "${f}" --out "${f%.*}.png"
done

If you want to convert and resize images

The following will convert and resize images so the maximum height and width is 400 pixels (but you can change 400 below to any value)

Be careful, this will convert and resize all .HEIC files in the directory - back them up first if you're not sure you want to do that just yet.

for f in *.HEIC
do sips -s format png "${f}" -Z 400 --out "${f%.*}.png"
done

Reference

Additional note

To convert from HEIC to jpeg, use the same code examples above but replace png with jpeg in 2 places, and you'll have jpeg instead.

3
  • sips doesn't support jpg? PNG is kinda weird for photographs.
    – Alper
    Aug 15, 2021 at 20:38
  • 1
    -s format jpeg and then --out "${f%.*}.jpg" to get jpg
    – philshem
    Oct 26, 2021 at 12:06
  • fwiw (photographers might not care) but expansion to *.jpeg or *.png takes a 1MB heic file and explodes it to ~7MB and ~11MB respectively. If you want to optimize for best disk space leave this alone.
    – avgvstvs
    Feb 8, 2023 at 18:18
4

Use ImageMagick to produce JPGs that are the same quality as the the original HEIC files.

I found @stevec's answer using sips produces very low resolution images that were basically useless for my purposes. So, I had to find a new solution.

for f in *.HEIC
    do magick "$f" -quality 100% "$f.jpg"
done
3
  • I prefer to use GraphicsMagick as it is smaller and more efficient (faster) than ImageMagick. The command line is the same except for the way it is called: gm convert….
    – Allan
    Jan 25, 2023 at 19:05
  • fwiw (photographers might not care) but expansion to *.jpeg or *.png takes a 1MB heic file and explodes it to ~7MB and ~11MB respectively. If you want to optimize for best disk space leave this alone.
    – avgvstvs
    Feb 8, 2023 at 18:17
  • I found out that sips also modifies the image occasionally. After converting 20 pictures of my kids, one of them had the same width and height but it was stretched horizontally a bit making my daughter look weird.
    – Najki
    Feb 24, 2023 at 20:52
-1

I did it like this:

for f in *.HEIC
    convert "$f" "$f.jpg"
end

That's using ImageMagick but I consider that something you should have on your system anyway.

1
  • I would look at GraphicsMagic instead. It’s a better alternative to IM and would probably be a better answer than the existing IM answer
    – Allan
    Jul 28, 2023 at 23:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .