Skip to Main Content

How to change the compression of JPEG files on WordPress

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

By default, WordPress compresses your images for better performance. Recently one of our readers asked us if it is possible to change the image compression setting on WordPress. In this tutorial, we are going to show you how to increase or decrease JPEG image compression in WordPress.

Every time you upload a JPEG image to WordPress, it will be automatically compressed to 90%. On WordPress 4.5, this number has further decreased to 82% in order to improve site performance for mobile users.

If you are a photographer who wants to showcase high quality images on their website, you can turn off image compression on WordPress.

How to Disable Image Compression in WordPress

All you need to do is paste the following code into the file " functions.php Of your theme or in a plugin that you will have created.

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

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

When you set the value to 100, it means that the compression will not have a big impact on the image quality. Percent compression works a lot like opacity in CSS. If the value is equal to 1, the element is visible, if the value is equal to 0 the value is invisible. In this case, if the compression is equal to 100, there is no compression. The lower the value becomes, the stronger the compression.

If you are not a photographer or an artist, then you probably won't notice a big difference in the quality. But for those who work with high quality images on a daily basis, the difference in quality is obvious.

How to Increase Image Compression in WordPress

There are certainly performance benefits to leaving the compression quality as it is. If you want you can change the number to 100-80 or a number less than that, all you have to do is paste the following code:

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

When making these changes to the image quality, you need to make sure to regenerate your thumbnails using this pluginTo simplify your life.

We hope this tutorial helps you learn how to modify JPEG image compression on WordPress. Feel free to share this tutorial with your friends on your favorite social networks.


This article features 0 comments

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top