How to Stop WordPress from Compressing JPEG Images?

Do you want to stop WordPress from compressing JPEG images?

By default, WordPress compresses JPEG images to enhance performance without significantly reducing quality. However, this may not always be the case, as the quality can sometimes degrade.

Although the default compression rate of JPEG images in WordPress is 82%, you might still prefer to keep the original quality. If you want to stop WordPress from compressing JPEG images and maintain 100% quality, you can use the code below to prevent WordPress from compressing JPEG images:

php
/**
 * Stop JPEG Image Compression in WordPress
 *
 * @return int
 */
function maverick_stop_jpeg_image_compression()
{
    return 100;
}
add_filter('jpeg_quality', 'maverick_stop_jpeg_image_compression');

The above code instructs WordPress to save JPEG images at 100% quality, effectively stopping WordPress from compressing JPEG images.

Stopping WordPress from compressing JPEG images is particularly useful for photographers, designers, and anyone who relies on high-quality visuals.

Leave a Reply

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