Every one wants to optimize images on their WordPress sites. But sometime you need to make an exception and have to upload a high resolution image. But still you wonder why the image look pix-elated and blur after uploading on WordPress front-end.

After reading this article you will know the theory behind this.

Default WordPress JPEG Image Compression

FYI, WordPress automatically compresses JPEG images to 90% of their original size. This is the default setting which compress every image uploaded to WordPress. There is no option to change this setting from/within your WordPress admin panel.

The motive behind this is to increase your page load time and improve your site performance.

However, this is a good feature with good motive but sometimes it can be annoying for some users.

For e.g. – If you are running a photography blog and want your photos to look at their best, probably that 10% compression is going to ruin your appearance. And the irony is – sometimes users don’t even know what is happening to their image quality after uploading to WordPress.

Reason, this is working completely under the hood.

Are you still staring the title words ” Default WordPress JPEG Image Compression ”? Than you fall in that “innocent users” category.

How To Disable The Default WordPress JPEG Image Compression

If you don’t want to compromise with the quality of your images and want to snitch back that extra 10%, you can turn-off this default setting.

Copy and paste the following filter code in the functions.php file of your theme.

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

As we assign the value to 100, WordPress compress the image at is highest quality i.e. no compression will take place at all.

How to Increase/Decrease Image compression in WordPress

Optimized and small size images plays an important role in speeding up your page load time. If you want to increase the image compression to scrap down few extra kBs paste the following code:

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

Play with the value (from 1-99) to increase or decrease the compression setting. Set the return value to 100 for disable the image compression ( as explained above ).

Smaller the value more will be the compression. Similarly larger value will lead to less compression.

Note: After making any image quality changes, the images uploaded to WordPress will be compressed according to new setting. But it will not affect the existing images in your media gallery. To change the quality of images uploaded before modifying the default setting, make sure to regenerate your thumbnails.

Hope this article helped you to change your default WordPress JPEG image compression.

Write A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.