24 February 2022
WordPress compresses your images by default for better performance.
When you upload a JPEG image to WordPress, it automatically compresses it to 90% quality. This figure was further reduced to 82% in WordPress 4.5 to optimize site speed for mobile visitors.
If you are a photographer who likes to display high-quality images on your website, you may disable image compression in WordPress.
In this post, I will show you how to disable image compression in WordPress with code snippets or plugins.
With an increasing emphasis on core web vitals to boost your website’s performance, using small-size fast-loading images has become very popular.
Because people are browsing websites on larger screens, the default width settings of blogs have become very large, causing users to upload large photos to provide a nice visual appeal.
There are several image compression WordPress plugins that optimize images to help them load quicker, and webP has emerged as the new standard, mainly because Google Pagespeed emphasizes that it reduces image size by 30%.
As a result, WordPress compresses images by default, but you can adjust this now. Otherwise, you risk compressing images twice, resulting in poor image quality and a poor user experience.
All you need to do is paste the following code in your theme’s functions.php file or a site-specific plugin.
add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;});
When the value is set to 100, WordPress compresses the picture to its highest quality.
There are several plugins in WordPress to optimize images. The most popular and recommended below is to optimize your images with WordPress.