Forced down-sizing of PNG results in blur (Chrome)

84 Views Asked by At

I have a 100px wide / 100px tall PNG image.

I resize it with CSS : img { max-width: 70px } .

The result is blurry.

What could be going wrong?

1

There are 1 best solutions below

0
elmarko On

It's probably because a 100px square doesn't divide down exactly to 70px the browser is mis-rendering bits of the image as it try to resize and interpolate the pixels of the image on the fly. Try it at max-width: 50px or max-width: 75px and see if it's still blurry.

Image resizing is much easier if you can divide down by a multiple of 2/4/8 to exactly to the size you want.

(assuming you're not on a HiDPI/retina screen, in which case it's because you don't have enough pixels at 75px square to render a full retina quality image.)