A few months ago I started building ImgFlowTools — a set of free image converters and compressors (PNG to JPG, HEIC to JPG, compress to an exact KB target, and about 50 others). The constraint I set myself on day one: no uploads, ever. Every conversion happens on the visitor's device with the Canvas API and createImageBitmap.
Zero server cost and total privacy were the obvious wins. But building this way taught me some things about browser image processing that I didn't find written down anywhere. Here are the ones that surprised me most.
- canvas.toBlob quality is not a file-size dial
My first assumption was naive: quality 90 ≈ a slightly smaller file, quality 50 ≈ half. Reality is messier, because JPEG and WebP encoders respond to quality non-linearly depending on image content.
Real numbers from testing my own tools:
- A 1.49 MB photo converted PNG → JPG came out at 471.8 KB at quality 90, and 290.3 KB at quality 80. A 10-point drop bought a ~38% smaller file.
- A 235.7 KB screenshot at quality 90 came out at 89.7 KB — screenshots compress far better than photos at the same setting, because flat colours and sharp edges are cheap to encode.
If you're building anything with a quality slider, test it against photos and screenshots and flat graphics. They behave like three different formats wearing the same name.
- Sometimes the "better" format makes the file bigger
WebP beats PNG almost always — except when it doesn't. A tiny flat transparent PNG of 22.6 KB came out of my PNG to WebP converter at 28.2 KB (quality 70). For small images with few colours, PNG's palette-style compression is already near-optimal, and WebP's overhead wins the wrong way.
The honest UX move: show the user both sizes and tell them when the conversion made things worse. Tools that hide this are lying by omission.
- Hitting an exact KB target means binary-searching quality
The most requested tool on the site is "compress image to exactly 200 KB" (or 100 KB, or 50 KB) — because exam forms, visa applications and job portals reject anything over a hard limit.
There's no formula for this. The only reliable approach:
- Encode at a guessed quality.
- Check the output size.
- Binary-search the quality value (and, if quality alone bottoms out, step the dimensions down) until the output lands just under the target.
In practice this converges in 4–6 encodes, which is fast enough to feel instant. On a 2.56 MB phone photo targeting 200 KB, my implementation settled at quality 13% and produced 186.4 KB — low quality on paper, but for a form upload that only gets viewed on screen, completely fine. You can try it here: compress image to 200 KB.
- Transparency will bite you in JPEG conversions
PNG → JPG sounds trivial until a user converts a logo with a transparent background and gets a black (or white) rectangle. JPEG has no alpha channel, so you choose the matte colour. I flatten onto white — it's what most users expect — but the important part is deciding deliberately and telling the user, not letting the canvas default decide for you.
Same category of trap: EXIF orientation. Phone photos often store rotation in EXIF metadata instead of pixels. createImageBitmap with imageOrientation: "from-image" handles it — skip that option and a percentage of your users get sideways photos and no idea why.
- The boring advantage: your server bill is a rounding error
51 tools, real traffic, and my hosting cost is a basic shared plan — because the heaviest computation (image encoding) happens on hardware I don't pay for: the visitor's phone or laptop. No upload queues, no file storage, no cleanup cron jobs, nothing sensitive on disk.
If you're building a utility site in 2026, it's worth asking of every feature: can the browser do this itself? More often than you'd think, the answer is yes — and the architecture gets simpler, cheaper, and more private in one move.
I build and run ImgFlowTools — 51 free image tools that work entirely in your browser. If you have questions about the Canvas API side of any of this, ask in the comments and I'll answer with the actual implementation details.