Every time you upload an image file to WordPress, an automatic lossy compression is applied for better performance and improve site performance for mobile users. What if you want to change the JPEG compression level used by default?
Below is the code to increase or decrease the JPEG compression level of the next image files you upload to WordPress.
<?php | |
//* Prevent JPEG compression | |
add_filter('jpeg_quality', function($arg){return 100;}); | |
//* JPEG compression level set to 75% | |
add_filter('jpeg_quality', function($arg){return 75;}); |
Alternatively, you can download, install and set up WP Resized Image Quality from the WordPress Plugin Repository.