DEV Community

tian song
tian song

Posted on

Resizing and compressing images without uploading them

Most image tools on the web open with the same line: drop your file here, we will process it on our servers. For a resize or a format change, that round trip buys you nothing.

What the server actually adds

A queue, a wait, and a second copy of your photo on a machine you do not control. The codecs doing the work are the same ones already shipped in every browser.

A resize is drawImage into a smaller canvas. A format change is canvas.toBlob with a different MIME type. Neither needs a network request.

Where this actually matters

  • Upload forms with a hard cap. If a form rejects anything over 200 KB, you need a target size, not a quality slider you drag until the number happens to fit.
  • Photos carrying location data. A server-side converter can keep the EXIF block; a local one never has to send it anywhere in the first place.

I keep two bookmarks for this: a browser-based image resizer for the first case, and compression to a target file size for the second. Both run entirely on the device, so the file goes from disk to canvas and back.

The tradeoff is real: no batch API, no server-side automation, and the tab has to stay open while it works. For one-off edits that is the right trade.

Top comments (0)