3 ms·
On a page like this you should really use the CSS style: img { image-rendering: pixelated; }
by panzi 2y ago
On a page like this you should really use the CSS style:
img {
image-rendering: pixelated;
}
- panzi 2y ago(Because otherwise it's all blurry on a high DPI monitor.)
- nox101 2y agoIt'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.
- panzi 2y agoWell, 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.