Darkroom: compressing images in the browser with no upload
2 min readNext.js · Developer Tools · Tools
Most online image compressors work the same way: you upload your files, a server shrinks them, you download the result. That is fine until the images are private, the connection is slow, or you simply do not want to hand files to a stranger's server. Darkroom takes the other route. It is a batch image compressor built with Next.js where every image is decoded, resized and re-encoded inside your browser.
What it does
- Accepts JPEG, PNG and WebP, up to 25 MB each, and queues as many as you drop in.
- Compresses to a target size in KB, with a quality setting and optional max width and height.
- Exports as JPEG, WebP or PNG, so it doubles as a format converter.
- Shows progress per image and for the whole batch, with the exact output size on each result card.
- Lets you download files one by one or all at once.
How target-size compression works
The browser's Canvas API does the heavy lifting. You draw the decoded image onto a canvas at the size you want, then ask the canvas to encode it at a given quality. Lossy formats like JPEG and WebP respond to that quality value, so hitting a target is a search: try a quality, measure the output, adjust, and stop just under the limit.
canvas.toBlob(
(blob) => console.log(blob?.size),
"image/webp",
0.8
);The size you get back is a real byte count, which is why showing the exact KB on each result card is more honest than a promised percentage.
Why PNG is the awkward one
PNG is lossless, so a quality slider does nothing. Darkroom's own FAQ says it reduces the dimensions instead to reach a target. That works, but it changes the picture size, not just the file weight. If you need a small PNG at full resolution, you may be better off exporting to WebP.
Where it bites
- Your device does the work. A big batch of large photos will be slow on an old phone and can use a lot of memory.
- Re-encoding is lossy. Compressing a JPEG again adds loss. Keep your originals.
- Metadata may not survive. Canvas re-encoding generally drops EXIF data such as camera info and orientation hints. Check before relying on it.
- Format support varies. WebP encoding depends on the browser, so test on the ones your users have.
- Privacy is a claim you can verify. Open the network tab while compressing and confirm nothing is sent.
I like tools whose privacy story is an architecture, not a promise. If the file never leaves the tab, there is nothing to leak.
Live: image.techlife24.store

Written by
Shihab Hossain — Full-Stack Developer
I build thoughtful digital products from Bangladesh — fast web experiences with Next.js, Android apps with Flutter, and the infrastructure behind them.
Work with me