Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to remove WordPress image compression

Would you like to remove the default image compression that WordPress applies to your uploaded images? WordPress automatically applies image compression to each image uploaded to your site.

This tutorial will walk you through how to turn off image compression with the use of simple code snippets.

Heads up!

This article contains PHP, CSS, and/or JavaScript to customize our plugin. We offer this code as a courtesy but don’t provide support for additional code customizations or 3rd party development.

To remove WordPress Image Compression, you’ll need to add the following code.

If you need help adding custom code to your site, please check out our guide on adding custom PHP or JavaScript to your site.

/* Envira - Remove WordPress Image Compression
* 
* @link https://enviragallery.com/docs/how-to-remove-wordpress-image-compression/
*/
add_filter('jpeg_quality', function($arg){return 100;});</pre>

Once code has been added, any new image uploaded will no longer be subject to WordPress’ image compression!

Note: Any image that was uploaded before enabling this code snippet will need to be re-uploaded to have the compression removed.

That’s it! Would you like to extend Envira further? Check out our tutorial on how to Remove Fragment Cache from Envira Gallery.