If you have a photography website or a site where the quality of the images makes the difference, you surely already know what I’m talking about, and it is an annoying problem with WordPress, which causes large images to lose quality when uploading them to your content.
Why is this?
Table of Contents
Why do images lose quality when uploaded to WordPress?
There are 2 possible reasons why your images lose quality just by uploading them to your WordPress site:
- WordPress automatically compresses JPG files, which can cause them to lose quality.
- WordPress automatically creates a smaller copy of images larger than 2560 pixels wide, with a loss of quality.
These problems only affect JPG files, so if you upload a file in PNG, GIF or WebP format it should not be affected.
I mean that if you upload an image that, originally is like the first one in the following gallery, after the automatic scaling of WordPress it looks like the second one, with less color saturation, and even loss of color profile, depending on the photo…
Is there a solution?
Although you may think that this problem is due to the first of the above, in reality, the problem is caused by automatic scaling, because even if you leave WordPress JPG compression active the bug is fixed by disabling WordPress automatic scaling of large images.
Solution with plugins
There are several plugins that allow you to manipulate the default WordPress behavior of automatically scaling images larger than 2560 pixels.
For example, SG Optimizer has a setting where you can change the size of the automatic scaling, or disable it completely, which would be in this case the solution.
Other plugins, such as Smush, also offer the possibility to remove this scaling.
Solution with code
If you prefer to use a simple code that completely solves the problem, simply add the following line to the end of the functions.php file of the active theme, or if you prefer using other methods of adding code to WordPress:
Common sense solution
You can’t forget the simplest and cleanest solution, without the need for plugins or code: reduce the size of the images before uploading them to WordPress.
I’m sure there are very few websites that need images larger than 2560 pixels wide for any reason, so why not upload them directly to the maximum size needed, so you won’t have any problem with WordPress automatically reducing the size.
I hope I helped you, although this problem will hopefully be solved, because WordPress should be able to automatically create smaller images, scaled, but without loss of quality.