admin管理员组文章数量:1122832
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?
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?
Share Improve this question edited May 18, 2016 at 9:57 Chris Jenkins asked May 18, 2016 at 9:30 Chris JenkinsChris Jenkins 114 bronze badges 3- You say you uploaded a PNG, but the referenced original image is a JPG? – TheDeadMedic Commented May 18, 2016 at 9:36
- Very good point, I've linked to a test by mistake. I'll edit the original question now! – Chris Jenkins Commented May 18, 2016 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 Commented May 18, 2016 at 11:13
2 Answers
Reset to default 1This 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.
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;
});
本文标签: imagesWordPress PNG compression issue
版权声明:本文标题:images - WordPress PNG compression issue 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302100a1931414.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论