CSS-Tricks / coding-fonts

https://coding-fonts.css-tricks.com/
MIT License
461 stars 67 forks source link

Drastically lower image quality on iPad Safari #94

Closed johnridesabike closed 3 years ago

johnridesabike commented 3 years ago

If you visit the site on an iPad, the image quality is much lower. It looks very low-res and pixelated. If I visit on my Mac, it looks normal. I haven’t tested on other machines.

I assume this has something to do with the way Cloudinary is serving different sizes and formats to different browsers?

I attached a screenshot. You can see how the image text looks compared to the actual text on the page.

PNG image
hronro commented 3 years ago

Not only on iPad, but also on macOS Safari.

CleanShot 2021-03-16 at 11 16 51@2x

OS Version: macOS 11.2.3 (20D91) Safari Version: Version 14.0.3 (16610.4.3.1.7)

chriscoyier commented 3 years ago

I see it too.

It's something jerked up with the responsive images syntax. If I put like https://res.cloudinary.com/css-tricks/image/fetch/w_1600/https://coding-fonts.css-tricks.com/screenshots/anonymous-pro/html-dark.png as the ONLY thing in srcset, it looks fine. So somehow Safari is deciding to download a far too-small version of the image.

Any ideas for fixes welcome.

eeeps commented 3 years ago

Took a quick first look:

  1. It's picking the 1200w resource when img.clientWidth is 840 (\@2x). It "should" pick the 1600w for better crispness here, but I think it's just doing what the sizes is telling it to. Lemmie workshop your sizes for a minute...

  2. Ticking this off also helped appearances (chunky → smooth)

Screen Shot 2021-03-25 at 1 34 40 PM
eeeps commented 3 years ago
Screen Shot 2021-03-25 at 1 41 59 PM

Pretty sure those should be min-widths.

eeeps commented 3 years ago

Gettin' a PR together...

eeeps commented 3 years ago

Left the -webkit-optimize-contrast, as I see that it was a recent, intentional change (#59).