How to change JPEG Image Compression Rate in WordPress

by Taswir Haider in Wordpress

imagesWordPress is the best blogging platform no doubt so far. But it has also some internal limitations such as comment spam, hacking, image setting etc. Though these type of problems do not exist in great extent, sometimes little tweak is enough to solve them.

By default WordPress automatically compress JPEG image quality to 90%. Though the change is not vital and doesn’t mean enough to a regular blog, but for photography blogs this can be an important issue.

How to change JPEG Image Compression Rate

You can leave the default image compression rating as it is but if you really want WordPress not to make any changes to image quality, just open your custom_functions.php and add below line of code.

add_filter('jpeg_quality', function($arg){return100;});

Here 100 denotes that WordPress will not make any changes to image quality and will keep it as it is (100%). You can change the value to 70 or 80 if you want the image to be automatically compressed up to that percentage.

Hope it helps!


Subscribe to RSS, Get Free Updates!

Previous post:

Next post: