Converting JPEG to HEIF and why it's a bad idea

One of the new features of macOS 10.13 High Sierra and iOS 11 is the addition of two new media formats:

• High-Efficiency Image File Format (HEIF) for photos.

• High-Efficiency Video Coding (HEVC), also known as H.265, for videos.

HEIF is intended to be a successor to JPEG, while HEVC will supplant H.264. Both of these new formats are industry standards and though they may not be in wide use at the moment, they will be real soon now for three big reasons:

  1. Add anything new to iOS and it quickly gets disseminated to tens of millions of iOS devices. Note Apple's comments about how it became the largest augmented reality platform overnight once AR technology shipped as part of iOS 11. We all suddenly had the chance to enjoy a T-Rex galavanting unencumbered around a basketball court.
  2. The two new formats have much better compression algorithms than JPEG and H.264, so photos and videos encoded with these formats will take up much less space on iCloud Photo Library and on flash-memory constrained devices like iPhones and iPads.
  3. Even though the new file formats compress photos and videos to a much greater degree, there is no loss of visual quality.

So... better quality and dramatically smaller file sizes? Sold! Where do I sign?

HEIF and HEVC are the future of digital photos and videos

The good news is that any photos or videos shot with recent iPhones (the 7 series or later) and iPads (the 10.5-inch and 2nd generation 12.9-inch Pro models) that are running iOS 11 will use these new media formats by default.

You have the option of continuing to use JPEG and H.264 formats on these devices if you want. But because Apple has already built in a mechanism to convert a HEIF file to JPEG when it is shared (for example, through email or Messages) there's no real good reason to use the less efficient JPEG format. It's a little dicier when it comes to sharing H.265 videos on some older devices, but the easy solution is to upgrade to macOS High Sierra and iOS 11 and work with the video in its new format.

So we have a rosy future ahead, with the ability to stretch our storage a bit farther without an increase in cost, leaving all the more room for AR T-Rexes to fill.

All of this, of course, begs the question: OK, so how do I convert all my old JPEGs to HEIF and H.264 videos to H.265? If saving space with no loss of quality is a good idea for new photos and video, isn't it an even better idea for the thousands of photos and videos I already have that are sucking up precious storage space?

Converting could be awesome, but right now, it's not

The internet is full of websites that offer to convert a file based on one format into another. You can find them with a simple search. Here are two that I came across, both of which offer the ability to convert your JPEGs to HEIF and H.264 videos to H.265.

And there are apps that'll do likewise. But because HEIF and HVEC are only now emerging as future mainstream formats, many of these websites and apps either can't handle the new formats at all, or have some detrimental byproducts, such as removing EXIF data (that is, data about a photograph, such as location and camera settings) during the conversion process.

One website, JPEGtoHEIF lists step-by-step instructions for converting a JPEG to a HEIF, but it's not for the faint of heart. If you understand terms like Homebrew, Git, cmake, and FFMPEG, you should give it a try and tell me how it worked out for you. But, if those sideloading programs kinda give you the shakes, do like I did and take a pass on that one.

Nevertheless, I'm the curious sort. So I did a little digging for some Mac apps that handle conversion while also safely hide the command line from me.

How I converted H.264 to H.265 and what my cat thought of the whole process

Video on iPhone

Handbrake, a free, open-source video transcoder, can convert H.264 files into H.265 format. I tested it with — what else? — a video of my cat playing with the business end of a laser pointer. The H.264 video was about 16 seconds long, 21.4 MB in size, and had a .m4v file extension. It took just a minute or so for Handbrake to convert it to the H.265 format. After conversion, the file was 5.4 MB in size (a 75% reduction in size compared to the original) and had a .mp4 file extension.

Great! So it worked... but not really.

The H.264 file would not open in QuickTime Player and only the audio played when I opened it with iTunes. So I tried it using VLC, a free video player that can handle a lot of different formats. To my eyes, there was no discernable difference in quality compared to the H.264 version (and the cat didn't corral the laser in either version of the video, I know you wanted to know that).

When it came time to drag the H.265 video into the Photos app so I could check on the status of the EXIF data, Photos wouldn't take it. Even sneakily changing the file's extension to .m4v didn't work. I used a couple of other apps to try to dig out the EXIF data to no avail.

So, I re-transcoded it using Handbrake back into H.264 format. Again, it took just a minute or so and created a file that, at 6.5 MB in size, was slightly larger than the H.265 version. I was able to successfully import it into Photos with a drag and drop (even though it retained its .mp4 file extension), but the EXIM data — specifically, the date and location of the video and the camera information — was missing.

The mess I made converting a JPEG photo to HEIF

HEIF photo

Image2HEIF costs a few bucks on the Mac App Store and will convert images in various formats (BMP, GIF, JP2, JPG, and PNG) into HEIF.

The app description makes it clear that "original EXIF/metadata is not transferred to converted .heic image". So no important information is saved like date, location, or camera settings. In addition, while I successfully converted three different JPEG files and saw no discernible drop-off in quality, the file size was not reduced by a significant amount. In fact, in two of the three cases, the HEIC files were slightly larger than their JPEG originals.

Just for fun, I converted a 3 MB JPEG file into a 20.9 MB PNG format using Preview's export command. Then I ran the PNG file through Image2HEIF and it produced a 2.9 MB HEIF file. So, you know, what's the point?

To make things even more difficult, all of the HEIF files were locked when I opened them with Preview, and when I tried to unlock them, I was informed that the file didn't support editing, so I was offered the chance to duplicate it into a TIFF format to edit. I could, however, just import and edit them in Photos.

Stop to think whether you should

In the movie Jurassic Park, the mathematician played by Jeff Goldblum has a rather close encounter with a T-Rex (of the non-AR variety), brought back to life through advanced genetic engineering. He delivers a very succinct ethics lecture to the project leader and his quest to bring dinosaurs back to life: "Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should."

I'm not saying that a JPEG converted to HEIF is going to rampage through your neighborhood, drink all the water in your swimming pool, tear the roof off of your house, and swallow you whole. But it could do something that you might not like. At the very best, it's a time-consuming process that doesn't really reduce the file size that much.

Based on my limited testing, it's probably not worth the effort for most folks to convert a bunch of videos and photos to the new HEVC and HEIF formats just to save some storage space. A lot of time and effort would be involved to make the conversions — not to mention having to recreate lost EXIM data. For me, with the current level of technology available, it's not worth the tradeoff.

At some point, the formats will become more mainstream and Apple will likely build something into Photos and/or iCloud that will help take care of this. In meantime, I'm going to stick with what I've got.

Any questions?

If you've tried converting photos or videos to the new formats, tell us about it in the comments below.

Mike Matthews

Mike Matthews is a writer at iMore.com. He has used Apple products all the way back to the Apple II+. He appreciates no longer having to launch apps by loading them from a cassette tape recorder.