Grainy and pixelated background images in Google Chrome: how to solve?

Hi all, i'm working on a Wordpress custom theme and I have this issue on Chrome. I'm using the thumbnail image as a background in various parts of the theme, set with background-size: cover and background-position: center, but they appear to be grainy or pixelated, as if they were low quality. I already tried the image-rendering property, but with no results. I also noticed that the issue exists when using Chrome, while on Firefox is working fine, and that occurs only when using the image as a background, as the same image used as an element in the post content does not have the same issues. It's driving me crazy, how can i solve this?
20 Replies
MarkBoots
MarkBoots13mo ago
nothing comes to mind. but can you show screenshots of the visual difference and share the code of how you apply them
DanRos88
DanRos8813mo ago
sure, here it is https://codepen.io/DanRos-the-scripter/pen/QWzzegO this is the Firefox output
Firefox output
DanRos88
DanRos8813mo ago
and this is the Chrome's one. Sorry for the double message, I messed up
No description
MarkBoots
MarkBoots13mo ago
are you per chance zoomed in on chrome? the text also looks a bit thicker
DanRos88
DanRos8813mo ago
and here is the grainy one as a background and as an image element in the post
No description
No description
DanRos88
DanRos8813mo ago
nope, i just checked
MarkBoots
MarkBoots13mo ago
hhm, looks like the browsers choose to render it differently. Probably nothing you can fix yourself . Keep the question open, maybe someone has ideas difference between the normal and bg-cover could be explained. it is resizing a bit
DanRos88
DanRos8813mo ago
yeah, i've read online that chrome does it. Thank you for your help
MarkBoots
MarkBoots13mo ago
good luck with the project
DanRos88
DanRos8813mo ago
they are both scaled, the original image is like 5000x5000 px (yeah, it should not be this big, was just trying), but the background one is also cropped by the background cover to adjust to the container dimension, while the second one it's not
MarkBoots
MarkBoots13mo ago
ahh, yea, with that size, little differences in rendering could be accentuated.
DanRos88
DanRos8813mo ago
but why only as a background and only on chrome? btw i'll try with smaller images to see if chrome persists with this behaviour
MarkBoots
MarkBoots13mo ago
no idea why, different browser engines under the hood
DanRos88
DanRos8813mo ago
e.g. these are way smaller (but still big, like 1600-2500 px wide)
MarkBoots
MarkBoots13mo ago
try to make them not larger then they will appear. also for the performance
DanRos88
DanRos8813mo ago
yeah, i'll give it a try. Thank you
MarkBoots
MarkBoots13mo ago
👍
John O
John O8mo ago
@DanRos88 - I came across your post. Did you ever find a good solution? I have a similar issue where Windows + Chrome the down-sampled image looks horrible. Windows + Firefox looks fine. Looks fine on Mac.
DanRos88
DanRos888mo ago
Unluckily, no.
John O
John O8mo ago
I've trying image-rendering and some other things found on google such as setting transform to force GPU. none of it seems to make a difference. Windows + chrome just looks worse when compared to Firefox on Windows or Chrome/Firefox on Mac. The down-sampling of Chrome+Windows is clearly inferior.
Want results from more Discord servers?
Add your server