Opened 4 years ago
Closed 4 years ago
#52752 closed feature request (duplicate)
Add basic image compression to WordPress core
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.7 |
Component: | Media | Keywords: | |
Focuses: | performance | Cc: |
Description (last modified by )
Dear developers,
I noticed that WordPress does no basic image compression when you upload a file resulting in images with huge and unecessary file size on many websites.
Here is an example: https://bartenberger.de/wordpress-reh/wp-content/uploads/2021/03/60464.jpeg
It's a tiny JPG I found on a wordpress website with a resolution of 100x50 pixel. The filesize for some reason is 8.7 megabyte. If I upload this image wordpress just takes it and it remains at the bloated filesize of 8.7 megabyte.
Why is this a problem?
I know that there are many plugins which take care of image compression in WordPress (Imagify, TinyJPG, Smush, ...). But I would suggest there needs to be some basic (lossless) image compression in Wordpress out of the box because many people don't install such plugins.
I recently ran a study in Germany, analyzing the filesize of thousands random Germany websites. Some websites had a file size of 10, 20 or 50 megabytes. When I took a closer look at them I found that most of them were Wordpress websites with huge images (3 megabyte or more each) that were just uploaded and not compressed by any plugin.
Google has also announced that the speed (and therefore size) of a website will have a bigger impact on the ranking through its Web Vitals (see https://developers.google.com/search/blog/2020/11/timing-for-page-experience). Obviously this is an even bigger issue on mobile devices.
Hope I made my argument clear and have not missed any feature that is already there ;)
Best,
martin
Hi there, welcome to WordPress Trac! Thanks for the ticket.
Just noting that WordPress does in fact have built-in image compression for intermediate image sizes, see the WP_Image_Editor::set_quality() method and these posts for more details:
That said, WordPress always stores the original uploaded image without any modifications so it could be reused in the future to create new intermediate copies if there are any changes to custom image sizes. Since I don't think we want to change that at this time (creating resized copies from other copies would result in quality loss, as noted in #19679), I'm not sure how actionable this ticket would be.
Ticket #37840 suggests adding a new image size to WordPress that is an optimized version of the original image, and using that on the front end instead of the original uploaded image. This appears to be similar to what is being proposed here, so I think the discussion can continue there.
In the future, this could be improved further with dynamic image resizing, see tickets #15311 and #21810.