Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use img { image-rendering: pixelated } #1097

Open
romanzenka opened this issue Sep 24, 2019 · 3 comments
Open

Use img { image-rendering: pixelated } #1097

romanzenka opened this issue Sep 24, 2019 · 3 comments

Comments

@romanzenka
Copy link

romanzenka commented Sep 24, 2019

Chrome automatically applies smoothing when drawing images to screen when in retina mode while the image was captured non-retina.

Since backstop's goal is to compare images, the smoothing is counterproductive. I am not seeing what the browser actually rendered - I get a blurred version instead.

The img { image-rendering: pixelated } style makes the image comparison render much crisper.

I am currently applying this style in DevTools, but I figure this could be done automatically by backstop.js.

@garris
Copy link
Owner

garris commented Sep 25, 2019

Does this also work for antialiased text?

@romanzenka
Copy link
Author

romanzenka commented Sep 25, 2019

Sadly, Chrome does not seem to support switching off font anti-aliasing, see https://stackoverflow.com/questions/18786829/webkit-font-smoothing-property-has-no-effect-in-chrome

I am after changing how reference/test/diff images get displayed in the HTML report in the browser:

Before "pixelated":
image
Everything is blurry, hard to see what is going on

After "pixelated":
image
Now I can actually see nice, square pixels in the image and understand what is going on somewhat better.

This is from Mac OS X retina display, capture was done on a non-retina Puppeteer, but in my experience, even displaying images with matching dpi, Chrome still smooths the pixels anyway.

@romanzenka
Copy link
Author

romanzenka commented Sep 25, 2019

I am realizing - this would make sense to enable only if the image takes more pixels in the browser than it has itself. If you are shrinking the image, switching off anti-aliasing might make some of the pink difference pixels disappear, confusing the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants