How to prevent Chrome from blurring small images when zoomed in?

When I'm trying to view pixel art up close, chrome starts blurring the image. I want to make it so that even when the image is zoomed in, I can still see the pixels in crisp detail, not a blurred one.


Update

As per the comments:

it is now possible in Firefox: image-rendering: optimizeSpeed; – Arnaud

Original

This isn't possible directly from the browser.

The smoothing is applied via an algorithm and most modern browsers do similar and in IE, Firefox and Chrome there is no way to turn this off.

http://productforums.google.com/forum/#!topic/chrome/AIihdmfPNvE

You do have other options, here are the 2 main points from the link above, both are Chrome addons.

image-resizer
imagezoom

You could apply the CSS code below in the browser, which will turn it off!

img { 
    image-rendering: optimizeSpeed;             /*                     */
    image-rendering: -moz-crisp-edges;          /* Firefox             */
    image-rendering: -o-crisp-edges;            /* Opera               */
    image-rendering: -webkit-optimize-contrast; /* Chrome (and Safari) */
    image-rendering: pixelated;                 /* Chrome as of 2019   */
    image-rendering: optimize-contrast;         /* CSS3 Proposed       */
    -ms-interpolation-mode: nearest-neighbor;   /* IE8+                */
    }

I made this bookmarklet to disable smoothing. I keep the link in my bookmark bar and tap it when I want to disable the antialiasing on a page, usually for pixel art or classic gaming:

javascript:(function pixelate() {
  const sheet = document.createElement('style');
  sheet.innerHTML = 'img { image-rendering: pixelated; }';

  document.head.appendChild(sheet);

  for(let i = 0; i < frames.length; ++i) {
    frames[i].document.head.appendChild(sheet);
  }
})()

The reason a bookmarklet was appealing is that I don't like giving extensions the "read and change all your data on the websites you visit" permission.


Possible in 2019 with the following CSS: image-rendering: pixelated;


I've noticed some issues with Chrome and Firefox when using GPU rendering with images. E.g.:

img {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

If you have any CSS statements with the following, try removing them and see if your image quality increases.