🗄️ Long-term storage

Archiving Photos Without Losing Quality

If you have tens of thousands of photographs, there is a way to reclaim roughly a fifth of the disk space without altering a single pixel — and it's fully reversible. This is how to do it properly, and how to store the result so it's still readable long after the drive it's on has died.

by Robert Castillo · Published · updated

📦 ~20% smaller🔒 Bit-exact reversible✅ Verifiable🕰️ Built to last

The trick that makes this possible

Almost every archive is mostly JPEGs, and almost every attempt to shrink one starts by re-compressing them — which quietly destroys quality every time you do it. JPEG XL offers something different: lossless JPEG re-packing.

Instead of decoding the picture and encoding it again, it takes the JPEG's existing compressed data and stores it more efficiently. The pixels are never touched. Typical saving is around 20%, and the original JPEG can be reconstructed byte for byte — not visually identical, literally the same file, checksum and all.

That last property is what makes this safe for an archive. You are not choosing between size and fidelity. You are storing the same data in a better container, and you can always take it back out.

What to convert and what to leave alone

✅

JPEGs — convert them

This is where the whole saving lives. Losslessly re-packed, fully reversible, no decision to regret later. If your archive is mostly holiday and family photos, this is nearly all of it.

✅

PNGs — convert them

JPEG XL's lossless mode usually beats PNG, often substantially on photographic content. Still lossless, still reversible, though not byte-for-byte the way JPEG re-packing is — the pixels are identical, the original file isn't reconstructed.

⚠️

RAW files — leave them

Your raw files are the negatives and they should stay exactly as the camera wrote them. Adobe's DNG already uses JPEG XL compression internally if you want the saving; converting proprietary raws yourself is not worth the risk.

⚠️

HEIC — think first

Converting HEIC to JPEG XL means decoding and re-encoding, so it isn't lossless. Worth it if you want off Apple's format, but it is a genuine quality decision rather than free space.

❌

Anything you're about to share

Keep working copies in JPEG. The archive is for storage; compatibility is for distribution. Mixing the two roles is how people end up unable to open their own photos.

❌

Video

Different problem entirely, different tools. JPEG XL is a still image format and has nothing to offer here.

Doing it properly

Test on a sample first

Take a hundred representative photos — a mix of resolutions, cameras and ages. Convert them, reconstruct them, and confirm you get the originals back. The browser converter is fine for a first look at what the size saving will be on your material.

Verify with checksums, not with your eyes

Before converting, record a hash of every original (sha256sum on Linux and macOS, Get-FileHash in PowerShell). After reconstructing, compare the hashes. Identical hashes mean the file came back exactly. This step is the entire reason you can trust the process.

Convert in batches, keep the originals

Work in batches you can afford to redo. Don't delete a single original until that batch has been converted, reconstructed and hash-verified. Disk space is cheaper than the photo of your grandmother.

Store it where it'll survive

Three copies, two different media, one off-site. It is an old rule because it keeps being right. A single drive full of beautifully compressed JPEG XL is one power surge away from being nothing at all.

Write down what you did

Put a plain text file in the archive root explaining what the .jxl files are, which tool made them, and how to reconstruct the originals. Your future self, or whoever inherits this, will not remember. This costs five minutes and is the difference between an archive and a puzzle.

The command line version

For tens of thousands of files you want cjxl, the reference encoder from libjxl. Converting a JPEG is the simple case — lossless re-packing is the default behaviour, so no flags are needed:

cjxl photo.jpg photo.jxl

And reconstructing the original JPEG from it:

djxl photo.jxl restored.jpg

Compare the hashes of photo.jpg and restored.jpg and they will match. Run that check on your sample batch before you trust it on the whole library, and again on a random sample afterwards — verification you don't actually perform is just optimism.

What you're trading away

It would be dishonest to present this as free. The cost is compatibility, and it is a real cost that lands squarely in the future.

A folder of JPEGs opens on anything with a screen, and will keep doing so for decades — JPEG is the most widely supported format in the history of computing, and nothing is going to strand it. A folder of .jxl files needs software that understands JPEG XL, and today that is a much shorter list.

Two things make the risk tolerable. The format is an ISO standard with an open-source reference implementation, so the specification cannot be withdrawn and the decoder cannot be taken away. And the reconstruction is exact, meaning you can convert the entire archive back to ordinary JPEGs at any point, with no loss, if the format never takes off.

That's the honest framing: you're borrowing 20% of your disk against a small future inconvenience that you can undo. For an archive you control, it's a sensible trade. For files you're handing to other people, it isn't.

FAQ

How much space will I actually save?
Expect around 20%: in our own test of 16 camera and phone JPEGs it was 20.7% overall, between 11% and 29% per file. Don't try to predict it from quality or size: the smallest, most heavily compressed file in that test (a 7.8-megapixel shot of swans) saved the most, 28.9%, while a high-quality poppy close-up saved 13.8%. Phone photos with an HDR gain map or a motion photo attached save less, because those extras are stored unchanged. On a 2 TB library that's roughly 400 GB — worth an afternoon of work.
Is it really lossless, or lossless-ish?
Genuinely lossless for the JPEG re-packing case, in the strongest sense available: the reconstructed file is bit-identical to the original, same checksum. That is a stronger guarantee than 'visually identical', which is what most tools mean when they say lossless.
What if JPEG XL dies?
You convert everything back to JPEG and lose nothing but the time. That is precisely why the byte-exact reconstruction matters — it's the escape hatch that makes the whole plan reversible.
Can I do this in the browser instead of the command line?
For a few hundred photos, yes — the converter here does lossless JPEG re-packing and never uploads anything. For tens of thousands, use cjxl: a script won't get bored, and it can hash-verify as it goes.
Does this work for scanned documents and artwork?
Yes, and it's a good fit. JPEG XL handles very large images — up to a billion pixels per side — so gigapixel scans stay in one file rather than being tiled.
Should I strip EXIF data to save more space?
No. Metadata is a rounding error in file size and irreplaceable in an archive — dates, camera settings, sometimes location. Keep it. JPEG XL preserves it through the conversion.