Premium WordPress Themes from Inspect Element
For Designers and Developers
Quick question for WordPressers: Does the WP featured image functionality “degrade” the image at all?
— Orman Clark (@ormanclark) March 21, 2012
A question I too was asking myself only recently but didn’t have the time to look at, but thankfully, Orman then posted a link to a solution:
Ref image quality of featured images in WP. Found this zilla.cc/GCdJWH
— Orman Clark (@ormanclark) March 21, 2012
I’ll archive the code here as the link is using Google’s cache as the site isn’t currently working.
add_filter('jpeg_quality', function($arg){return 100;});
Just add the single line above to your functions.php file if you’re using PHP5+, otherwise you’ll have to use the code below. Change 100 to the percentage quality you want the thumbnails to be saved out to.
function jpeg_quality_callback($arg)
{
return (int)100;
}
add_filter('jpeg_quality', 'jpeg_quality_callback');
I haven’t tested this yet but a number of people in the comments of that post confirms it works.
For Designers and Developers