by Artem Syzonenko

??????? ?????? ??? ??????????

We didn’t have any problems with image sharpness in the early years of the internet, because we didn’t need to show websites on mobile devices.

Today we see a tremendous growth in mobile web surfing. So much so that, this year, it has even overtaken traffic on desktops.

Most clients try to create responsive interfaces for their websites so they are easily accessible from any kind of device. And it doesn’t seem strange that many layout developers have started to use

img {    width: 100%;    height: auto;}

for their images. So they seamlessly work across any browser window resolution, scaling to the available space.

Conceptually, everything looks good. Designers create nice big images, and developers use those images for every device. In some cases, developers create multiple versions of the same image, so a smaller image is downloaded for mobile screens, and a bigger image for desktops.

Unfortunately, Chrome doesn’t want to resize images in the way that good image editors do. Instead, it out-puts the image with not the same, or similar, sharpness as the initial image.

The main reason for this may be performance. When a webpage has many images, and the device processor is not highly productive, additional image processing could lead to bigger lags in page rendering, so Chrome omit this process as not being crucial for end users.

I will show you some examples using Chrome browser, and then using other browsers. Here is an image, downsized to 1000 px in Photoshop:

p3CocXKzlnqR5uvf6HbVhVgCnE70Ynm7ZQ05

The same image uploaded in original size and downscaled by the browser. Compare the sharpness of the dog’s eyes.

zAYTeXpAh1bUR0aN5MRPPwRM4WwUuBfmRw0E

Photoshop:

MT9wN0-IV03ciDdfEBttFh-dy0Fu1SKgilh6

Browser:

1JIKBussg2rHRn8cGh8aWIuIXmumdz0U-dsJ

Things get even worse when you add sharpness in Photoshop after downsizing. But photos are more forgiving in this case, as they typically don’t have many sharp edges. Issues with any vector illustrations saved as .png images are much more noticeable. Frequent case — website logos.

Asana’s logo, initial file:

e8z-EqJpznFEu6dqUX2Ua-8Wy51Uxud8YHL3

Resized in Photoshop:

DbLHnazFStTVSo747egAYyXIYDjzi5lpXabV

Rendered in browser:

wDhtJ1mLm5bOLJGicJT7q7xJHUCCaiEZdIH4

Wecan’s logo, initial file:

1hC3uLn30qgGBR-1MWFHvSsqzDW20oyY6yzE

Resized in Photoshop:

RjPFtUTpIQeJlxV4cCuLB8II5VCQTcpEjqdF

Rendered in browser:

x1RRYrFv4DdhON3ltDBDl35kEOeYRkGAsrVK

And couple of additional browser-rendered logos:

ouCcaxukdHILKRgTrmpNA-I5pPnPJaiQHOo5
lYfep1rskONTeB3AuXfAG920srkFn7BHv6hU

I found the most amusing comparisons of blurred images on UX-related websites. Smashingmagazine Jobs section, in browser:

UamRmft6o8kbYirqSa2eJA9KGFrw-QL-FFSj

In Photoshop:

cKeYICWv7mwuLBZCdiyXzGfM141RA4T5INIR

Nielsen Norman Group, Empathy Mapping article, rendered graph:

twV8egvF54Jor1g3TFFFQ0R33we8PMhFpU0-

Using Photoshop resizing:

nnxTrvhPdkYNYVAtgqSk44wX9kQPmyYM-3xx

I must admit that this problem is Chrome-only. IE renders much better; it is noticeable that some thin lines are pixelated, which is fine for text:

YibTGvoeZ6OIu2vrdDmTU5g31qAAQbz3yxiV
-S6IZIjXsVofiaXKhi9FSYaBrJCjP-engifw
LRjv7ULSc0mCs2fodHTqN5LgIqGF6q8lvOTa

Firefox has good rendering as well; smoothing makes text a little less readable than in IE, but is better for logos:

V45f6xLRlAlDlNffdDWBzu8fEQHs42JvdCqe
g9Gc99XrBffYI5im9vFS2wrORHBjRabrkULX
lmAUt7Mvu6yBp9PkMFVGKK9-7-eBIHoqyyhc

What developers should do right now is to turn on webkit auto-sharping property:

img {    image-rendering: -webkit-optimize-contrast;}

This is what we would get if it was turned on:

ZG0AOa6b-JkbTAYgp2pASpxbeWTwr4UzSfy5
vCERaeq5p6YpYfYvMi2kv2YKAns1Wl-7gGBn
51RdQBlurbGD0Qy8VgDVK2eClSFIgxyxmNJX

So, before the most popular browser in the world implements a good image down-sampling algorithm, we can use webkit-optimize-contrast property, which allows visitors to our sites to enjoy our photos, discern item details in our online shop, and appreciate readability of our screenshots and diagrams. But be careful, in some cases it can lead to pixelated results.