How to stop JPEG image compression in WordPress?

WordPress automatically compress the uploaded images to reduce their size. This can be helpful to load pages faster. But, in some cases quality of uploaded images can be important (e.g in Designer, Portfolio or Photography website).

See Also: Changing Excerpt Length in WordPress

To solve this problem, all you need to do is copy the following code snippet and paste it in your functions.php file.

//Stop JPEG image compression in WordPress
add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );




Leave a Comment.