Guide
How to compress a JPEG without losing quality
Updated · The Shipping Labs, makers of Fino
Truly lossless optimization keeps every pixel but saves only a few percent: 5.8% on our 89 camera photos. To make a JPEG much smaller with no difference you can see, re-encode it with a setting chosen for that photo and check it region by region, at 100%. If the photo is bigger than where it will be shown, resize it first: nothing saves more.
- Lossless optimization
- Identical pixels, single-digit savings (5.8% on our 89 camera photos)
- Lower quality number
- Bigger savings, but no single setting suits every photo
- Perceptual search
- −69.5% on the same 89 photos with Fino, measured by us
- Biggest lever
- Resize when the photo is larger than where it will be shown
What does “without losing quality” really mean?
One of two things, and tools rarely say which. Lossless means every pixel stays exactly the same: only the way the file is packed changes. Visually lossless means the pixels do change, but you can't see the difference at the size you look at the photo. Only the second can make a JPEG much smaller.
Camera photos and high-quality exports have room to spare; the question is how much of it you can take before anyone notices.
Perceptual metrics put that question on a scale. SSIMULACRA 2, an open-source metric published by Cloudinary, defines its levels by how people compare images: at 80 an average observer doesn't notice the distortion side by side, at 85 not even when the two images swap in place, and at 90 not even in a flicker test, which is its definition of visually lossless. How we measure image quality explains how we use it.
What are the ways to make a JPEG smaller?
At the same dimensions there are three, and they differ in how much they save and how much can go wrong:
| Method | Typical saving | Risk to the image | Effort |
|---|---|---|---|
| Lossless optimization | 5.8% in total (3–8% per photo) | None: the pixels are identical | Low: one command or app |
| Lower quality number | Large, but uneven from photo to photo | Banding, halos and blotchy skin on the photos the number doesn't suit | Low to apply, high to check every photo |
| Perceptual search | −69.5% with Fino at its default strength | Low, as long as every region of the photo is checked | Needs a tool that runs the search |
Lossless optimization: same pixels, a few percent smaller
A JPEG packs its compressed image data with Huffman coding, and many cameras and editing apps write baseline files with generic tables. Repacking the same data with tables optimized for that photo, as a progressive JPEG, makes the file smaller without changing a single pixel.
jpegtran, which comes with libjpeg-turbo, does exactly that. Its manual explains that it rearranges the compressed data without fully decoding the image, so there's no degradation at all. On our 89 camera photos it saved 5.8% in total, between 3% and 8% per photo, and the decoded pixels were identical.
The catches: the saving is small, so it won't fix a file that weighs several times what it should. And by default jpegtran keeps only comments, dropping the camera data and the color profile, unless you add -copy all.
Lowering the quality number: why one setting suits no photo
This is what Save As, Export and most web tools do: decode the photo and save it again at a lower quality, say 80 instead of 100. The number sets how coarsely detail is rounded off, and the savings can be large.
The trouble is that the number says nothing about what you'll see. Smooth areas show damage first: a clear sky picks up visible steps (banding), sharp edges against flat areas grow faint halos (ringing), and skin can turn blotchy. A busy scene of leaves or fabric hides the very same setting. So a number low enough for the easy photos damages the hard ones, and one safe for the hard ones wastes space on the rest.
It isn't even a unit: each app maps the number to its own quantization tables, so 80 in one program isn't 80 in another. If you export from Lightroom, our Lightroom export guide shows how to get smaller files without guessing a number.
Perceptual search: a setting chosen for each photo
The third way automates what a careful person would do by eye: encode smaller and smaller versions of the photo, compare each with the original using a perceptual metric, and keep the smallest one the metric can't tell apart. Every photo gets its own setting; easy ones go far, hard ones stop early.
How the comparison is summed up matters. One score for the whole photo is an average, and a damaged patch of sky can hide behind it when the rest of the frame is busy. Checking the photo region by region, and judging it by its worst region, catches that.
Tools that work this way range from jpeg-recompress, an open-source command-line tool whose default metric is SSIM, to desktop apps; our roundup of JPEGmini alternatives compares the ones for Mac and Windows. The cost is time, since each photo is encoded and measured several times.
Is the photo bigger than where it will be shown? Resize it
If it is, resizing saves more than any compression setting. File size roughly follows the pixel count, which falls with the square of the dimensions: halve the width and the height and only a quarter of the pixels remain. Our 24-megapixel test photos are 6048 pixels on the long edge, wider than almost any screen, so in a web gallery most of those pixels are downloaded only to be scaled away.
Resizing does remove detail, so keep the full-size file for printing and archiving, and resize a copy for each place it goes. Never enlarge a photo: it adds weight, not detail.
What should you avoid?
- Saving the same JPEG again and again. Every lossy save rounds the detail off once more, and this generation loss adds up. Edit from the original and export once.
- Compressing photos that are already compressed. Files that went through an optimizer, a messaging app or a website upload have little room left, and a second lossy pass risks visible damage for a small gain. Only a lossless pass is safe.
- Stripping the color profile. Photos edited in Adobe RGB or Display P3 depend on their embedded ICC profile. Without it, apps assume sRGB and the colors shift, usually duller. Make sure your tool keeps it, along with the camera data you care about.
- Web tools with caps and uploads. TinyPNG's free version takes up to 20 images at a time, 5 MB each, and keeps uploads for up to 48 hours. Our camera photos average 5.7 MB, so about three in four wouldn't fit, and the photos leave your computer.
How do you check the result yourself?
Not on a thumbnail: at small sizes almost any setting looks fine. Instead:
- Open the original and the compressed version at 100% zoom, so one pixel of the photo fills one pixel of the screen.
- Flip between them in the same spot instead of placing them side by side. The eye catches changes far more easily when the image swaps in place.
- Look where compression shows first: skies and other smooth gradients, skin, fine textures like hair, fabric and foliage, sharp edges against flat areas, and deep shadows.
- Finally, view the photo at the size people will actually see it. That's the test that counts; 100% is the safety margin.
Where Fino fits
Fino is our desktop app for macOS and Windows, and it runs the perceptual search described above: it tries smaller versions of each photo, compares them with the original region by region using SSIMULACRA 2, and keeps the smallest one you can't tell apart. A photo that can't get at least 3% lighter is left exactly as it was, and one that's already compressed only gets a lossless pass.
Measured by us on 89 camera photos of 24 megapixels at the default strength: −69.5%, from 511 MB to 156 MB, at about 0.25 s per photo on an M1 Pro, with EXIF, XMP, IPTC, the ICC profile, dates and Finder tags kept byte for byte. You pick the strength (Flawless, about 60% smaller; Identical, about 70% and the default; Compact, about 72%), and the Compare view has a before/after divider and a 100% loupe.
Its limits: JPEG in, JPEG out. No PNG, WebP, AVIF, RAW or video, and no Lightroom plugin. It's free for 14 days with everything, then 20 photos every 24 hours. For whole folders, see how to batch compress JPEG photos; for downloads and pricing, see the Fino page.
Questions
How do I reduce the size of a JPEG without losing quality?
If the photo is bigger than where it will be shown, resize it first. Then re-encode it with a setting a perceptual metric picks for that photo, checked region by region, and compare it with the original at 100%. A lossless optimizer alone keeps every pixel but saves only a few percent.
Is lossless JPEG compression really lossless?
Lossless optimization is: tools like jpegtran repack the same data and the decoded pixels are identical. But many tools that say “lossless” mean visually lossless, which does change pixels. If a file comes out half its size, the pixels changed.
What JPEG quality should I use?
No number is right for every photo: a setting that's invisible on a busy scene can band a clear sky. If your tool only takes one number, test it on your hardest photos at 100% and use the lowest one that still looks identical there.
Why are my photos so large?
Because cameras record a lot of pixels and editing apps often export at very high quality. Our 24-megapixel test photos average about 5.7 MB each, and most of that weight can go without a visible change.