HomeinetChange jpeg image compression in WordPress

Change jpeg image compression in WordPress

By default, WordPress compresses your images for better performance. Below we will see how you can increase or decrease the compression of .jpeg images in WordPress.

Whenever you upload a jpeg image to WordPress, the software will compress it to 90% quality. As of WordPress 4.5, this number has been reduced to 82% to improve website performance for mobile users.Compress WordPress

Now if you are a photographer and want to display high quality images on your website, then you can disable image compression in WordPress.

Let's see how:

All you need to do is copy and paste the following code into the functions.php file. The file is located in the theme you are using.

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

By setting the value to 100, you are assured that WordPress will compress the image to its highest quality.

If you're not a photographer, then you probably won't see much of a difference in quality. But for those who work with high-quality images on a daily basis, the difference in quality is obvious.

But let's see what we can do for those who are not photographers and are more interested in the performance of their website:

If you want, you can further reduce the number to gain a few kbs from each image you upload to your site.

Copy and paste the following code into the functions.php file:

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

After these changes to image quality, you should run the Regenerate Thumbnails.

 

📧
Subscribe to the SecNews Newsletter

The most important Security & Technology news in your Inbox.

SecNews
SecNewshttps://www.secnews.gr
In a world without fences and walls, who needs Gates and Windows

SEARCH

FOLLOW US

📧
Newsletter SecNews
The most important Security & Technology news in your inbox.

LIVE NEWS