Increase Default JPEG Compression In WordPress

WordPress vs. Photoshop Compression

By default, WordPress automatically compresses JPEG images with its built-in library. In WordPress, the newest compression default is set to 82. 82 is the percent the image was compressed compared to when it was originally uploaded. In most cases, decreasing this number too much will cause image distortion.  Therefore, WordPress’ default compression percentage of 82, is a good number to go by when compressing your images.

For comparison, when exporting images from PhotoShop, the percent the image was compressed, is 60%. This has minimal impact on the actual appearance of the image. The only time you will begin to notice the distortion of higher pixels is if you zoom in very closely.

There is a lot of research on image quality vs. image compression. More than I can go into on this article.  However, it is still important to know how to change the level of compression on your site, in case you ever needed to do so.

How to Change JPEG Compression in WordPress?

The first thing you need to do is have access to your own site-specific plugin or a child theme’s function.php file.

add_filter( ‘jpeg_quality’, create_function( ”, ‘return 100;’ ) );

The above code will effectively disable the compression all together. This is because the lower the number is the more compressed your images will be. To set your images at a lower compression level to match that of Photoshop, try adding this to your file.

add_filter( ‘jpeg_quality’, create_function( ”, ‘return 60;’ ) );

That is all there is to it. You are now able to disable the image compression or increase it to the same level as PhotoShop. Keep in mind that this will only affect JPEG images, therefore if you are looking to optimize other images you will need to download your own image compression plugin.

By | 2017-12-15T03:28:09+00:00 November 9th, 2017|Tutorials|0 Comments

Leave A Comment