Customize the default WordPress Image Compression
WordPress uses its own compression for images that are uploaded directly into WordPress. This happens automatically every time you upload an image. By default, the compression level of 82% is used. This ensures that the file size of images is reduced, but the image quality is not compromised too much.
How can I change the compression level of images?
Sometimes it may be useful to decrease or increase the compression level of images, for example, when automatic image quality reduction of WordPress is undesirable. To avoid the loss of image quality, we can use the filters
Just paste the following code snippet into the functions.php file of your theme:
So, if you don’t want to use the automatically compression of images in WordPress, replace “82” with “100”. So your images will be uploaded uncompressed in the future.
Old images have to be regenerated!
Please note: The new image quality does not automatically apply to old images that have been previously uploaded. For this, all images must be regenerated. In this case you can use a plugin like Regenerate Thumbnails:
Once the plugin has gone through, the new image quality will also be applied to all older WordPress images.