Compresso
You’re holding a 3 MB photo. The form wants 2.
A form that wants 2 MB
“Upload a photo under 2 MB.” The form knows what it needs. All you know is that your photo is too big.
You don’t know what a megabyte is. You don’t know which app could shrink it, or if that app keeps a copy. So you give up, or you ask someone who knows.
Work the system handed to people
The form could have shrunk the photo itself. It passed that job to you instead. People get through forms like this and still can’t say what happened.
I wrote a paper about forms like this. It names the problem: work the system should do, handed to the person. Compresso is that paper, turned into a tool.
So I gave the work back to the system. Type in the form’s limit, 2 MB, and Compresso does the rest. It tries quality levels until it finds the best one that fits.
Dimensions
Give it the form’s limit and it does the work: it looks for the best quality that still fits. Drawn in code from the live product.
- Note 1: The form’s limit goes in as a number. Compresso tries quality levels until the file fits under it.
- Note 2: Quality starts at 80 percent, the product’s default. Slide back to it and a small tick lights up, but nothing snaps.
- Note 3: Auto picks the best format this browser can write, so nobody has to know what WebP is.
- Note 4: Once a limit is set, this fold stays open, so a limit you chose is never hidden.
Nothing leaves the device
The first rule was that your photo stays with you. Compresso runs in the browser, on your own phone or laptop. Once you install it, it works with no connection at all.
Make images lighter.
Drop them here. They are compressed on this device, by this device. Nothing is uploaded, and it works with no connection at all.
Choose imagesor drop them anywhere · paste with ⌘V
JPEG · PNG · WebP · AVIF · HEIC
Docs/FAQ/npm/On-device0 B sent
Make images lighter.
Pick a few photos. They are compressed on this device, by this device. Nothing is uploaded, and it works with no signal at all.
Choose photosStraight from your camera roll
JPEG · PNG · WebP · AVIF · HEIC
On-device0 B sent
The first screen makes the promise before it asks for anything. Drawn in code from the live product.
- Note 1: The promise comes first: compressed on this device, by this device, and nothing uploaded.
- Note 2: One white pill, the only filled shape in the app, for the one thing you came to do.
- Note 3: The status line keeps the promise in view while you work: 0 B sent.
- Note 4: On a phone the words change. A phone has no cursor to drop with, so it says “Pick a few photos”.
It reads HEIC photos from an iPhone, and JPEG, PNG, WebP and AVIF. Big batches are split across your device’s cores, so the page never freezes.
I built Compresso alone, but not for me. I kept picturing the person at the form, on a phone, on a weak signal. The library behind it is 3.6 KB gzipped,That’s the whole library, gzipped. I kept it small so a team could add it to their own upload form, and the code is open for anyone to check.Compresso on GitHub so a team can add it to their own form.
Never return a bigger file
Some photos are already small for what they hold. Run them through a compressor and they can come out bigger. Most tools hand that bigger file back anyway.
Compresso makes one promise instead. With a lossy format, you never get back more bytes than you gave. If it can’t beat your file, it lowers the quality or the size until it does.
A promise is only real if something fails without it. So a regression test pins it, and the build goes red if a bigger file slips through.The test lives in Compresso’s own suite, so anyone can read the promise right next to the code that keeps it.
There is one place the promise can’t hold. PNG has no quality dial, so a photo saved as PNG can grow. When it does, the app says so in plain words and offers WebP.
Kept as PNG, this file grows. PNG has no quality dial, so convert to WebP to actually shrink it.
Convert to WebPWhere the promise can’t hold, the app says so, in the only red it has. Drawn in code from the live product.
- Note 1: Red appears on this one condition and nowhere else in the app.
- Note 2: The fix is one tap away, in the same words the note just used.
One run, not an average
My first notes on the library had rounder numbers: a size, a saving and a speed. I couldn’t tie each one to a run I could show. So I took them all down.
What’s left is one photo, compressed once in the live app. It went from 3.3 MB to 93.5 KB.One photo, compressed once in the live app. I didn’t average it or keep the best of several tries. This is what happened that one time. Drag the slider to replay it, drawn to scale.
3.3 MBSide 100% of the original · drawn to scale by area
One measured run: 3.3 MB to 93.5 KB. Not an average.
That’s one run on one photo. Another photo will land somewhere else. I’d rather show you one true number than a nice round one.
What I’d tell the next team
- Publish the one run you measured, not the average you hope for.
- A promise is only real when a test fails without it.
- When a form asks people to do the system’s work, move the work, not the people.
Field notes from this work
- Never return a bigger fileA promise is only real if something fails without it.