Improve Image Quality and Color in WordPress

Ever notice how WordPress smushes your JPG images down to 60% quality after your upload them?  Add the snippet below to your theme’s functions.php or alternatively, download this plugin to improve the quality of your JPG images to 100%.  Please note: You will sacrifice speed for quality.

function gpp_jpeg_quality_callback($arg)
{
return (int)100;
}

add_filter('jpeg_quality', 'gpp_jpeg_quality_callback');

11 responses to “Improve Image Quality and Color in WordPress”

  1. wheatgrass juicer Avatar

    Thanks for the tip.

    Tammy

  2. Paul Bridge Avatar
    Paul Bridge

    great plugin!

  3. Francois Avatar
    Francois

    Hello Thad,

    thanks for your work to improve image quality on wordpress, I was very disappointed by wordpress when I saw degraded quality after my upload.

    However it’s like your code does not work on my website. I will try to explain my case :

    If I upload a picture which size (width, height) is larger than my “large picture size” set up in wordpress config, the quality is degraded after upload.

    If I upload a picture which size is lower than my “large picture size” set up in wordpress config, quality is OK.

    I have the same results with or without your code in my function.php.

    Do you have an idea of what is going on please ?
    Thanks
    François

    1. Graph Paper Press Avatar

      Sounds like WordPress is “up-sizing” your images François. This honestly shouldn’t happen. Perhaps your theme is scaling up the images using CSS to fit the site design. Themes sometimes do this.

      1. mazi Avatar
        mazi

        Any Idea where in css i can find it? cos i have similar situation the pic what i upload is very bad and its doesnt metter which size is photo.

  4. atherdon Avatar
    atherdon

    Cool.
    Thanks!

  5. Elga Avatar
    Elga

    I think we need to replace gpp with our theme name in code

  6. Pamela @ Brooklyn Farm Girl Avatar

    I installed this plugin but unfortunately it’s not working with WordPress 3.9.1 The same bad quality is showing. 🙁

  7. Julian Avatar

    Checking the class-wp-image-editor.php file I noticed there is another function that has a higher priority over the filter.

    set_quality() has priority over the filter.

    It would worth to consider it.

Leave a Reply

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