logoalt Hacker News

Why Tiny JPEGs Look Different in Chrome

86 pointsby gutechhtoday at 2:00 PM14 commentsview on HN

Comments

jonathanlydalltoday at 3:33 PM

I'm pretty sure the same issue happens with PNGs, which being lossless are generally good for icons as they don't land up with compression artifacts like what happens in JPEGs (which the author points out are really for photographs), they also support alpha blending.

When Chrome introduced this "optimization" and it made it through to an Electron release which we were upgrading to, it really messed up the icons in a lot of places in our product such that we had to hold off the upgrade until we had SVGs to replace them.

SVGs also have the advantage of being able to respond to light/dark mode. We just needed to put each icon in its own shadow DOM to avoid styles clashing between the different SVGs if they happen to be named the same which was a bit of an annoyance for our graphic designer.

show 2 replies
muizelaartoday at 3:00 PM

The work for decompressing at a lower scale in Firefox is happening here: https://bugzilla.mozilla.org/show_bug.cgi?id=2033250

show 1 reply
debazeltoday at 2:50 PM

Chrome and Firefox uses two different scaling algorithms that is probably contributing a lot more to this difference. Chrome is more blurry in general while Firefox is sharper but has slightly more ringing artifacts. Personally I prefer the Firefox version.

show 2 replies
PetitPrincetoday at 2:46 PM

So is Firefox doing a full rendering then scaling, or is it also doing a partial rendering but in another way? You're only telling one side of the story.

show 2 replies
bluedinotoday at 3:12 PM

Reminds me of digging into HTML Canvas scaling, especially when HiDPI Macs came out.

smallnixtoday at 2:53 PM

Would be nifty if they only did that partial scaling when there's little memory available.

show 1 reply