How to stop WordPress from compressing your uploaded jpeg images

The WordPress Media Library is a powerful tool for managing and displaying images on your website. However, by default, WordPress compresses uploaded JPEG images to 90% of their original quality. While this feature aims to save hosting bandwidth, it may not always be ideal, especially for websites focused on selling or showcasing high-quality images. Fortunately, there are several workarounds available to bypass this default compression and ensure optimal image quality on your website.

 

Embrace PNG Images

One of the quickest and most effective workarounds is to utilize PNG images instead of JPEGs. Unlike JPEG, PNG is a lossless compression file format, meaning it retains the original image quality without sacrificing details or introducing artifacts. This makes PNG ideal for displaying line drawings, text, and iconic graphics at a small file size. By opting for PNG, you can ensure that your images appear crisp and vibrant, making it an excellent choice for designer websites or photography portfolios.

Code Modification in the Theme's Function.php

For those comfortable with making code modifications, another option is to edit your theme's function.php file. By adding two simple lines of code, you can override the default JPEG compression settings and set it to 100%, effectively preserving the original image quality. The following code snippets can be added to your theme's function.php file:

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

Once saved, your WordPress installation will no longer compress JPEG images, ensuring that they retain their full quality and visual appeal.

Plugin Solution for Controlling JPEG Compression

For users who prefer not to modify theme files directly, a convenient plugin called WP Resized Image Quality  can provide granular control over the compression level of all uploaded JPEG files. This plugin allows you to specify the desired compression rate for both full-sized images and their thumbnails. By adjusting the settings to your preference, you can strike a balance between image quality and file size, achieving the optimal visual experience for your website visitors.

While WordPress compresses uploaded JPEG images by default to conserve hosting bandwidth, this may not always be desirable, especially for websites that rely heavily on image quality. By implementing one of the mentioned workarounds, such as using PNG images, modifying the function.php file, or utilizing a specialized plugin, you can ensure that your website presents high-quality images, catering to the needs of design-oriented or photography-focused websites. By optimizing image quality, you can enhance the visual appeal and user experience of your WordPress site while still maintaining control over file sizes and website performance.

Let us take care of it for you, for free!

All new hosting and maintenance clients receive a free HOUR of support each month for theme or plugin fixes, site optimization or malware removal!

GET FREE WP FIX NOW!

Comments (4)

  1. Quintin Reply

    April 21, 2015 at 6:12 pm

    Hi, I added the code you mentioned:
    add_filter(‘jpeg_quality’, function($arg){return 100;});
    add_filter( ‘wp_editor_set_quality’, function($arg){return 100;} );

    and when i added a new image it was still smaller than the image on my harddrive.
    I downloaded it again just to make sure and the sizes were as follows:
    Original: 192k
    Uploaded file: 95k
    How could this have happened?

    I am really confused about this now.

    1. Fix My WP Reply

      April 26, 2015 at 12:19 am

      Quintin I don’t know what happened, since this guide was written about 2 yrs its not so current. You may also want to see if you have any image compression plugin like wp smush or if your theme is compressing the images.

  2. Yasmin Reply

    January 29, 2017 at 2:08 pm

    Hi, thank you for this post. I’ve had a rubbish time trying to get my blog images to look crisp and vivid on wordpress, and failed with so many pieces of code and plugins. I never even considered using PNG file format, because almost all of my images are photos, but I gave it a go and the latest one I uploaded as my featured image looks lovely. Thank you! As loading time doesn’t bother me too much, this is perfect, even if it takes 1 or 2 seconds longer for readers.

    Could you tell me, are there any other real downsides to using the PNG file format? I’m curious to know before I make all of my images PNG from here on out.

    Thanks again 🙂

    Yas

    1. Fix My WP Reply

      February 6, 2017 at 12:53 am

      Hi Yasmin.
      THe PNG format is usually preferred for showing drawings, shapes and text while JPEG is better at showing photos.

Leave a Reply

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