logoalt Hacker News

nox10112/10/20241 replyview on HN

It's not that simple because the user's devicePixelRatio might be fractional. Say it's 1.5, then scaling up, some low-res pixels get scaled up to N pixels and other to N+1 and you can get something really ugly, especially if the thing you're scaling is a stippled pattern.


Replies

panzi12/12/2024

Well, I consider that still vastly better for pixel art than it being blurry. If you really want to handle 1.5x resolutions you can scale the image to that resolution yourself in the way you think is best and provide it using srcset.