1

I'm having issues with images getting badly compressed when uploaded to my site. It's not an issue with photographs, but is very noticeable for images with solid blocks of colour and text.

I've uploaded a PNG with a solid grey background overlaid with white text, and it's being badly compressed when WordPress resizes it to the various alternative sizes.

Original image

Large featured image size

Unfortunately I don't have enough reputation to post more than 2 links, but you can see in the resized Large version that the text has become very blurry, and the solid grey background has a noticeable strobe to it.

I know you can turn off / adjust the level of JPG image compression, but as far as I know WordPress shouldn't be compressing PNGs at all, so I'm at a loss to figure out what's going on.

What could be causing this? Is this potentially an issue with the compression / resize software on my server? Or is there a way to tell WordPress not to compress PNGs, like there is with JPEGs?

  • You say you uploaded a PNG, but the referenced original image is a JPG? – TheDeadMedic May 18 '16 at 9:36
  • Very good point, I've linked to a test by mistake. I'll edit the original question now! – Chris Jenkins May 18 '16 at 9:40
  • Hmm, yep, can definitely see the artifact. Trouble is I think this is beyond WordPress - it's more likely an ImageMagick/GD issue (PHP image libraries). Might be worth looking for a public resizing API - if you can find one that gives you the results you're after, a new question "how to integrate service X into WordPress resizing process" would be a worthy candidate. – TheDeadMedic May 18 '16 at 11:13
0

This probably has to do with the ImageMagick library that WP normally uses to resize images. I'm not sure whether it is possible to modify the standard settings WP applies, but it is possible to define your own. Here is a tutorial for that. You would have to replace the filter in that tutorial with one of your own using ImageMagick's interface. But that's a lot of work.

0

https://www.revilodesign.de/blog/wordpress/jpeg-jpg-bildkomprimierung-aendern/

You must set the compression rate higher. i think this will be help you.

Since the Wordpress Version 4.5 is the compression rate 82% - before 90%

add this to your functions.php

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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