Change the Default WordPress Thumbnail JPG Compression Quality

  • Tom Kenny

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:

I’ll archive the code here as the link is using Google’s cache as the site isn’t currently working.

[php]add_filter(‘jpeg_quality’, function($arg){return 100;});[/php]

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.

[php]function jpeg_quality_callback($arg)
return (int)100;

add_filter(‘jpeg_quality’, ‘jpeg_quality_callback’);[/php]

I haven’t tested this yet but a number of people in the comments of that post confirms it works.


Coming Soon...

The Learn from Great Design Volume 1 eBook


The bad news is it isn't ready yet but the good news is you can get three case studies for free, right now. Simply sign up and I will send it to you immediately. People subscribed to the email newsletter also get a discount on the book when it's released.

The book will contain 20 LFGD case studies (I spend at least 5 hours on each one) but there will be another version of the book with even more studies and at least 3 masterclasses, with even more in-depth studies of great design. One of them is the travel giant Airbnb.

Sign up below to get notified of the launch.

Free. No spam. Unsubscribe any time.