Lean Image
Open menu

Converting a JPG library to HEIC

If you have arrived here with a folder of JPEGs and a plan to halve what it costs you in storage, the plan is sound and the format is not available. Nothing running in a browser can write a HEIC. What people want from HEIC is a modern codec that produces much smaller files at the same quality, and there is one that is free to use — AVIF, which is what the tool below is set to.

Loading the optimizer…

Nothing is uploaded. Every image stays in this browser tab —here is how that works.

The blocker is a licence, not a missing feature

This is not a case of nobody having got round to it. HEIC is a container holding HEVC-encoded frames, and HEVC encoding is covered by patent pools that license it per unit — per device, per copy, per encoder shipped. That model works for a phone manufacturer who can count handsets. It has no answer at all for a web page that anyone can open, runs code nobody registered for, and writes files nobody counts.

So the encoder does not exist in a form a browser could load. libheif, the WebAssembly library this site downloads when you open a HEIC, reads them and cannot write them. That is not an oversight in the library; it is the shape of the licensing.

Decoding is the half that got solved, because Apple and Microsoft and the chip vendors already pay for it. Writing is the half that stayed behind the toll gate.

AVIF is the version of this that exists

The reason HEIC is small is that it is a video codec doing still images: HEVC’s intra-frame coding, applied to one picture. AVIF is the same idea built on AV1, a codec designed from the start to be royalty-free, which is why every browser vendor could ship it and did.

The practical result for a JPEG library is a file somewhere between a third and a half of the original at a quality you will not distinguish, with room for wide colour and high dynamic range if the source has any. Unlike a HEIC, it opens on Windows, on Android, on Linux, and in every current browser — so the archive you build does not become somebody else’s compatibility problem later.

The cost is time. AVIF encoding is genuinely slow, in the way that running a video encoder over a 12-megapixel still is slow. For a few dozen photos that is fine. For ten thousand, a browser tab is the wrong instrument and a desktop batch tool is the right one, and we would rather say so than have you leave a laptop running for a week.

What you gain, and what you do not

You gain storage. That is the whole of it.

You do not gain quality — the detail your JPEGs discarded when the camera wrote them is gone, and no re-encode brings it back. Running the picture through a second lossy encoder cannot improve it, and at a low enough setting it will visibly make things worse, because the encoder cannot tell the JPEG’s blocking artefacts from the picture and spends bits preserving them.

Which is why the sensible order is: convert the folders where size is genuinely the problem, keep the originals of anything you care about until you have looked at the results, and leave the rest alone. Half a library that is 40% smaller is a real win. A library you have re-encoded twice because the first pass was too aggressive is not.

Where a HEIC actually comes from

Two places, both Apple’s.

On an iPhone or iPad, Settings › Camera › Formats › High Efficiency makes the camera write HEIC directly. On a Mac, Preview › File › Export offers HEIF, and Photos will export HEIC from your library. All of them run Apple’s licensed encoder, on silicon Apple pays the royalty for.

Here is the part worth sitting with, though: for photographs you already have as JPEGs, that export gains you very little. HEIC’s efficiency comes from encoding the camera’s original data once, well. Re-encoding a JPEG into a HEIC inherits every artefact the JPEG already carries, and hands you a file that a stock Windows machine cannot open. If you want your photographs to be HEIC, change the camera setting and the next few years of them will be. Converting the past is the wrong end of the problem.

Questions people ask about this conversion

Why can no free tool write HEIC?

Because a HEIC holds HEVC-encoded image data, and the patent pools covering HEVC license encoding separately from decoding, charging per unit shipped. Decoders are everywhere; a free encoder that a web page can download and run is not something anyone is in a position to publish. libheif, the library that reads HEIC on this site, ships decoding only for exactly that reason.

Will AVIF really get as small as HEIC?

In the same neighbourhood, and frequently below it. Both are still images produced by a video codec’s intra-frame coding — HEVC in one case, AV1 in the other — and AV1 is the newer of the two. Against the JPEGs you already have, expect somewhere between a third and a half of the size at a setting you would not be able to pick out in a comparison.

How long does a large batch take?

Longer than you would like. AVIF encoding runs a video codec over every picture, and a full-resolution photo can take several seconds on its own — a few hundred of them is a coffee rather than a click. They do run several at a time across your processor cores, and the progress shown on each card is the honest state of it rather than an animation.

Can I convert a JPG to HEIC on a Mac?

Yes, and it is the legitimate route. Preview will open your JPEG and export it as HEIF through File › Export, and Photos will export HEIC from a library. Both go through the encoder Apple licenses for its own hardware — which is precisely the licence a web page has no way to hold.

Should I re-encode my library at all?

Only if the JPEGs are genuinely costing you something. Re-encoding is a second lossy pass over pixels that have already been through one, and it buys disk space rather than quality. Keep the originals until you are sure, and start with the folders you never open rather than the ones you print from.

Related

Other things you can turn a JPG into

Try it with your own file

Drop an image in and see the result before you download anything.