I made a small browser tool to shrink chat photos and remove metadata
I send photos through WhatsApp and Telegram pretty often, and I've always found two things annoying. One is the file size. A photo from my phone can easily be 5 MB or more, which feels unnecessary when I'm just sending
I send photos through WhatsApp and Telegram pretty often, and I've always found two things annoying.
One is the file size. A photo from my phone can easily be 5 MB or more, which feels unnecessary when I'm just sending someone a picture in a chat. Some apps compress photos automatically, but the results aren't always great. Others have upload limits, and large files can be a pain on a slow connection.
The other thing is metadata. Photos taken on a phone can contain GPS coordinates, the phone model, the date and time they were taken, and other EXIF information. Most people probably don't think about this when sharing photos. I didn't pay much attention to it either until I started looking into how much information a single image file can carry.
Why not just use an online compressor?
There are plenty of image compression websites out there. The problem is that many of them ask you to upload the original photo to their servers.
That seems a little backwards if part of the reason you're compressing the photo is to remove private information.
I wanted something that could do both jobs without sending the original image anywhere.
Browsers already have the tools needed for this. You can load an image locally, resize it using Canvas, and export it as a new JPEG, WebP, or PNG. That also removes the original EXIF, XMP, and IPTC metadata.
So I put together a small tool around that idea.
The tool
It's here: Chat Image Shrinker
You select the chat app you're sending the photo to, add your images, and download the processed versions.
I added presets for WhatsApp, Telegram, Discord, Slack, and WeChat, mostly because those are the apps I wanted to cover first.
It supports JPEG, PNG, and WebP files, and you can process up to 30 images at once. There's also a ZIP download option, which saves a bit of clicking when you're dealing with a bunch of photos.
If the preset doesn't suit your needs, you can open Adjust settings and change the output format, longest edge, image quality, or maximum file size.
One feature I particularly wanted was the metadata report. Under each image, the page shows what metadata it found in the original file and what was removed.
I also didn't want the tool to recompress everything blindly. If an image is already small enough and has no metadata to remove, there's no point changing it. And if re-encoding makes the file larger, the tool can preserve the original image data while stripping the metadata instead.
Everything runs locally in the browser. There's no image upload endpoint, and the page's Content Security Policy restricts network requests to the same site.
Does it actually make much difference?
With one of my phone photos, the original file was 5.48 MB.
Using the WhatsApp preset, it came down to 146 KB.
That's a pretty big reduction, and when I viewed the result on my phone, it still looked fine for normal chat use.
Of course, that won't happen with every image. A detailed photo, a screenshot with small text, and a simple picture of a meal will all compress differently. But for the kinds of photos I usually send in chats, the results have been good enough.
The annoying part was figuring out the limits
I thought the image processing would be the hardest part. It turned out that finding reliable upload limits for different chat apps took more effort than expected.
Some apps document their limits clearly. Others have different limits depending on whether you're using a regular account, a bot, or a business API. And sometimes even the official help pages don't agree.
Discord was a good example. I found an official page mentioning 20 MB for free accounts, while an older page still referred to 10 MB.
Telegram's Bot API documents a 10 MB limit for photos, but that doesn't mean every Telegram upload works the same way.
So instead of pretending there's one correct number for every app, I linked the sources next to the presets. When I chose a value myself, I labeled it that way.
For example, the Telegram preset uses a 2560 px longest edge. That's my choice for a reasonable chat image size, not an official Telegram requirement.
I figured that was better than presenting guesses as platform rules.
A small thing I learned
Before building this, I assumed an image shrinker should always try to make files smaller.
But sometimes that's not useful.
If someone uploads a small JPEG that's already well-compressed, processing it again might make it look worse or even increase its size. In that case, removing the metadata without changing the actual image is a better result.
That ended up being one of the more useful parts of the tool.
Anyway, it's a small project, but I've found it handy.
If you want to try it, here's the link again:
Chat Image Shrinker
No account needed, and the images stay in your browser.
I'd be interested to know how it works on older phones, especially with large images or batches of photos. If something breaks, or you run into a format it doesn't handle properly, let me know in the comments.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.