WordPress does automatically compress JPEG images at 90% of their default quality to ensure speedy response time for your site. As a photographer or simply if you don’t want to loose the quality of your JPEG images when uploading into your WordPress blog, here I will show you how to improve the WordPress JPEG image quality by using the following filter. All you need to do is paste the following code in your theme’s functions.php file or your site-specific plugin.

/** JPEG Image Quality Filter */
add_filter( 'jpeg_quality', 'my_jpeg_quality' );
function my_jpeg_quality( $arg ) {
	return 100;
}

Change the return value to the quality you wish. I have set it to 100 in the function which means the image will retain 100% of it’s original display quality. You can change the number from 100 to 80 or something lower to squeeze a few more KBs.

You may also be interested in our other articles on increase the size of excerpt fieldwordpress adding fields to categories, exclude categories from blog wordpress and wordpress get taxonomies for post.

One thought

Leave a Reply