1

I’m lost I don’t know where to turn.

I am trying to get my thumbnails to NOT be compressed at all. My uploads are nice and colorful, but the thumbnails gets very visibly duller and poorer quality. I already added this code to my function.php file in my child and parent theme:

add_filter(‘jpeg_quality’, function($arg){return 100;});
echo get_the_post_thumbnail($id, array(100,100) );
add_filter( ‘jpeg_quality’, create_function( ”, ‘return 100;’ ) );
add_filter( 'wp_editor_set_quality', 'wpse246186_image_quality' );
add_filter( 'jpeg_quality', 'wpse246186_image_quality' );
function wpse246186_image_quality( $quality ) {
    return 100; // 0 - 100% quality
}

I’ve installed ‘Disable JPEG Compression’, and I’ve installed EWWW Image Optimizer and upped the compression quality to 100. I keep regenerating thumbnails using the ‘Regenerate Thumbnails’ plugin. But there is still a huge difference. I do not know what to do, I’ve searched the web up and down, idk what I am missing. Is it because my images are Adobe 1998 and not sRGB when I uploaded them?

Here is an example of the good image: http://ninasveganrecipes.com/wp-content/uploads/2018/03/web-blackberry-icecream-4863.jpg

Here is a thumbnail of it looking BAD (dull!): http://ninasveganrecipes.com/wp-content/uploads/2018/03/web-blackberry-icecream-4863-1080×1619.jpg

Please help me! I don’t know what to try or what I am doing wrong. Running PHP 5.6.30 on my wordpress site.

Thank you. -Nina Marie

4
  • This isn't an image quality issue. This is some image optimization issue, are you sure you not using 3rd party image optimization services? What are "EWWW Image Optimizer" doing with your pictures? Commented Apr 24, 2018 at 13:14
  • Don't know if this is only here, but you have some curly quotes in your code where there should be straight quotes. ‘jpeg_quality’ vs 'jpeg_quality'.
    – Florian
    Commented Apr 24, 2018 at 13:46
  • I installed EWW to try using it to up my compression to 100, aka no compression. no luck though://
    – Nina Marie
    Commented Apr 24, 2018 at 16:20
  • Interesting! Let me see if the curly quotes are in my code... nope they are not. :/
    – Nina Marie
    Commented Apr 24, 2018 at 16:21

3 Answers 3

3

(this should be a comment, but my reputation is too low)

Setting jpeg_quality will not disable compression because it does not disable processing. JPEGs will be always compressed, and they are almost never lossless, not even at 100 - it does not stand for "100% original quality".

What happens here, is that WordPress's default image processing does not respect color profiles, just as @Bigue Nique says.
To add some insight: WP ignores color profiles from the images and the browser sees them as unprofiled/sRGB. The loss of saturation is a typical artifact when the AdobeRGB profile is stripped.
As a photography student I had made that mistake for years (luckily, my pictures were usally grey ;).

It still makes sense to shoot and use AdobeRGB, or other color profiles, just make sure to convert to sRGB (important: convert to profile, not apply profile) at the very last step of your workflow. You can then even strip the potentially embedded sRGB profile and thus make the image unprofiled, since it does not make a difference in appearance - this is what image size optimizers do to save a couple of bytes.

I'm sure there are plugins to do the profile conversions automatically, but it is good practice to be aware of color profile issues when you publish to the web (say, forums or customers who don't have that plugin).

@Nina Marie - please mark an answer (Bigue Nique's) as the correct one.

2
  • I use Figma to create some images, they already export as sRGB (which I can check in Photoshop) but the problem is still there when comparing images as pure URLs. Original full image is good while resized image is slightly lower quality. Some parts are blurry but I can also see that a word which should be white looks a bit greyish
    – Marko
    Commented Jun 8, 2021 at 8:47
  • @Marko - localized loss of saturation/lightness is almost certainly related to JPEG's compression - both in downsampling chroma/lightness and "simplification". Again - JPEGs will always be compressed & will almost always lose detail (both in terms of sharpness & color). There are smarter compressors where you can set "regions of interest" with a higher quality but this will almost certainly never work with WordPress. If you need full control either a. turn off intermediate sizes (and accept the load time penalty) or b. don't use WP. Or as always, c. there's probably a plugin for that ;)
    – kubi
    Commented Jun 8, 2021 at 11:12
2

Uninstall the plugin and add this to your functions.php file

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

However please be aware that . you should still compress you images prior to uploading them for the performance enhancement.

4
2

Make sure you convert your images to sRGB before uploading them to WordPress.

Image compression should not dramatically affect the colors and tones of the picture. When you witness a significant shift in color, hue, saturation or contrast, it might be a color space issue (as the asker pointed out herself).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.