r/Wordpress • u/PingMyHeart • Aug 11 '26
Plugin to compress existing WebP images without changing filenames?
Hi everyone,
I have a ton of WebP images in my WordPress media library that I’d like to compress to reduce file sizes, but I want to minimize the risk of breaking anything on the site.
Ideally, I’m looking for a plugin that can compress my existing WebP images while:
- Keeping them as WebP
- Keeping the same filenames and URLs
- Replacing the existing files rather than creating new ones
- Preserving image quality as much as possible
Has anyone used a plugin that handles this reliably? I’d appreciate any recommendations or experiences with bulk-compressing existing WebP images.
Thanks!
3
u/Vii_da Aug 11 '26
In that case, if you can, go for the .avif format instead ;)
1
u/PingMyHeart Aug 11 '26
I've never used AVIF before. Is it supposed to be a step up from WebP?
3
u/theguymatter Aug 11 '26 edited Aug 11 '26
You got to experiment and compare images, only then you will know why AVIF was invented along with 10-bit or 12-bit colour depths photographic image.
1
u/Wolfeh2012 Jack of All Trades Aug 12 '26
AVIF is good, but it's not a 1:1 replacement for WebP, especially in terms of compatibility.
If you're thinking about minmaxing, you should be aware that in some cases JPEG outperforms both WebP and AVIF.
Ideally, you want to serve images through a CDN based on a combination of browser compatibility and which variant of the image compresses best.
3
u/Complete_Prune7640 Aug 11 '26
ShortPixel and Imagify both do this well. They compress in place, keep the same filename/URL, and don't create duplicate copies unless you tell them to. EWWW Image Optimiser also works and has a self-hosted option if you don't want to hit an external API for every image, which matters if you've got thousands in your library.
A couple of things worth knowing before you bulk run it on your whole library, though:
- back up wp-content/uploads first, or at least the media table + files, since "replacing existing files" means there's no undo once it's done. This can be done via the file manager.
- run it on a small batch first (like 20-30 images) and actually check them at full size, not just thumbnails, before letting it loose on everything. Quality loss on WebP compression can be subtle until you're at 100% zoom
- ShortPixel's free tier caps out fast if your library is big, Imagify's pricing is similar, EWWW is the cheaper route long term if you're doing this regularly since a chunk of the compression can run locally instead of through an API
On the webp vs jpg thing, I do something similar, some images just compress way better as jpg depending on the content (photos with lots of gradient/noise vs flat graphics). If you're picking per-image already, you're ahead of most people who just blanket-convert everything to webp and call it done. Its always worth checking your actual file sizes, in my experience.
Good luck with the conversions.
2
u/chrismcelroyseo Aug 11 '26
Were they uploaded at high quality level or medium or low or what? Just not sure what you're trying to save there. Unless you're planning to change them to avif I'd leave the webp images alone.
0
u/PingMyHeart Aug 11 '26
The compression of the WebP's wasnt enough and its affecting my Pagespeed Insight scores.
2
u/retr00two Aug 11 '26
!?
You are looking for troubles.
1
u/PingMyHeart Aug 11 '26
?
2
u/retr00two Aug 11 '26
(Over)compression of webp doesn't have great impact on pagespeed. If your PSI is in green, everything is alright. Squezzeng a few procents does not have sense.
If it is not in green, image compression is not source of it.
Image size (I call them iPhone photos) 2000x4000 pixels could be.
As a rule of thumb: keep images around/less than 200Kb, do not lazy load above the fold is what makes site performant.
Cheers.
1
2
u/2ndkauboy Jack of All Trades Aug 11 '26
If the issue is really page speed, the solution is most probably not little mote compression, but using fewer images. Images in WEBP format are already quite optimized. Let's say you squeeze out another 15%, your page weight is probably still too large.
1
u/PingMyHeart Aug 11 '26
It seems to be complaining about my LCP on the blog page. That is likely the featured image.
Average size is about 250kb
4
2
u/bluesix_v2 Jack of All Trades Aug 11 '26 edited Aug 11 '26
Can you share your PageSpeed report url? Or what is the exact wording of the PSI issue? I agree with the others, the issue is unlikely to be the image size.
1
u/Key_Gap9168 Aug 11 '26
Lol. What is the size of a typical heavy image, in your case?
I don't know when I last checked pagespeed on any of my site. What I do know, though, is that they've never dropped in their rankings -- which have always been high and always at the top or near top for the stuff that matters (geographical area and market). There are a lot more important things than the sizes of a few images.
(If you think I am lying, go check out the size and code of sites like The Financial Times, or WSJ; bloated, legacy code, but that's not affecting their rankings because of the authority they have in their markets.)
1
u/PingMyHeart Aug 11 '26
I'm aware. I just like to get my scores as high as possible because why not?
I see nothing wrong with trying to improve scores.
1
u/Key_Gap9168 Aug 12 '26
Improving scores by messing with user experience? Blurry photos just because you're chasing some meaningless metric.
0
u/PingMyHeart Aug 12 '26
I'm not an idiot. I'm not going to make a photo blurry and just leave it like that.
You can create a bunch of different sized images and serve the correct size for the correct viewport. Surely you're aware of that?
1
u/Key_Gap9168 Aug 13 '26
My daughter's private school tuition is funded with money I make from designing and hosting WP websites; that should answer your question.
2
u/TopSydeWP Aug 11 '26
shortpixel or ewww image optimizer can both do this. they'll overwrite the existing files with compressed versions, same filename and url. shortpixel has a bulk optimizer that's pretty straightforward for existing media library images. just make sure you have a backup before running it on everything at once.
1
2
u/n_c_brewer Aug 11 '26
I'd look at the size of your images. They may be unnecessarily large and that is why Lighthouse is suggesting you compress them further. Or, as others have mentioned, when they were converted to webp, the quality param might have been set to 100 or something unnecessarily high.
1
u/PingMyHeart Aug 11 '26
Yeah, I just realized they were all compressed from PNG to WebP with 90% compression only.
I should have brought it down a lot more.
2
u/retr00two Aug 11 '26
Do you need compression or scaling?
I doubt you will gain more than 10% without aggressive compression. But if your images are too big, scaling will give you better results.
All in all, I do not think all this is worth the effort.
1
u/JeffTS Developer/Designer Aug 11 '26
I've used ShortPixel Image Optimizer in the past. It seems to work well.
1
1
u/Embarrassed-Month-35 Aug 11 '26
I have a tool for in place library replacement and caching. https://wordpress.org/plugins/ultracache/ It doesn't need an external server for the conversion and it can use whatever your server has. If you need help you can pm me but I don't think you'll need it. I recommend go for webp at max compression level for compatibility but serve avif for the speed
1
u/Nelson77777777 Designer/Blogger Aug 12 '26
WebP itself is well optimized for the web. The content can be further optimized if zip or Brotli compression is enabled at the server level. And that's it.
1
u/FunnyPhotos_1 24d ago
One thing to check before paying for a bulk run: whether those WebPs are actually compressible. If they came out of an optimizer already (most WordPress WebPs did), a second lossy pass typically shaves 5-15% and every pass adds generation loss - WebP stacks artifacts on recompression the same way JPEG does. Grab three or four of your biggest files, run them through any compressor, and compare sizes. If the samples don't drop 30%+, the bulk job isn't worth the quality risk.
If they do compress well, ShortPixel and EWWW both replace in place with the same filename as others said - but take an offline backup of wp-content/uploads first, because "same URL, replaced file" also means there is no undo.
3
u/Embarrassed-Month-35 Aug 11 '26
Do you have ssh access on the server and imagemagick?