This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The image-rendering CSS property indicates the algorithm to use when scaling images. When applied to an element, the property applies to the element itself, to any images supplied in its other properties, and to its descendant elements.
/* Keyword values */ image-rendering: auto; image-rendering: crisp-edges; image-rendering: pixelated; /* Global values */ image-rendering: inherit; image-rendering: initial; image-rendering: unset;
The user agent will scale an image when the page author specifies dimensions other than its natural size. Scaling may also occur due to user interaction (zooming). For example, if the natural size of an image is 100×100px, but its actual dimensions are 200×200px (or 50×50px), then the image will be upscaled (or downscaled) using the algorithm specified by image-rendering. This property has no effect on non-scaled images.
Note: The Canvas API can provide a fallback solution for crisp-edges through manual image data manipulation.
| Initial value | auto |
|---|---|
| Applies to | all elements |
| Inherited | yes |
| Media | visual |
| Computed value | as specified |
| Animation type | discrete |
| Canonical order | the unique non-ambiguous order defined by the formal grammar |
Syntax
Values
auto- The image should be scaled with an algorithm that maximizes the appearance of the image. In particular, scaling algorithms that "smooth" colors are acceptable, such as bilinear interpolation. This is intended for images such as photos. Since version 1.9 (Firefox 3.0), Gecko uses bilinear resampling (high quality).
crisp-edges- The image must be scaled with an algorithm that preserves contrast and edges in the image, and which does not smooth colors or introduce blur to the image in the process. Suitable algorithms include nearest-neighbor and other non-smoothing scaling algorithms such as 2×SaI and hqx-family algorithms. This value is intended for pixel-art images, such as in browser games.
pixelated- When scaling the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels. When scaling down, this is the same as
auto.
optimizeQuality and optimizeSpeed present in an early draft (and coming from its SVG counterpart) are defined as synonyms for the auto value.Formal syntax
auto | crisp-edges | pixelated
Examples
/* applies to GIF and PNG images; avoids blurry edges */
img[src$=".gif"], img[src$=".png"] {
image-rendering: crisp-edges;
}
div {
background: url(chessboard.gif) no-repeat 50% 50%;
image-rendering: crisp-edges;
}
Live examples
image-rendering: auto;
78%
100%
138%
downsized
upsized 
image-rendering: pixelated; (-ms-interpolation-mode: nearest-neighbor)
78%
100%
138%
downsized
upsized 
image-rendering: crisp-edges; (-webkit-optimize-contrast)
78%
100%
138%
downsized
upsized 
Specifications
| Specification | Status | Comment |
|---|---|---|
| CSS Images Module Level 3 The definition of 'image-rendering' in that specification. |
Candidate Recommendation | Initial definition |
Note: Though initially similar to the SVG image-rendering attribute, the values are quite different now.
Browser compatibility
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | Yes | No | 3.6 | No | Yes | Yes |
crisp-edges | Yes1 | No | 3.6 -moz- | No | Yes -o- | Yes1 |
pixelated | 41 | No | No | No | 26 | ? |
optimizeQuality | No | No | 3.6 | No | Yes | Yes |
optimizeSpeed | No | No | 3.6 | No | Yes | Yes |
| Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
|---|---|---|---|---|---|---|---|
| Basic support | 41 | ? | ? | ? | ? | ? | ? |
crisp-edges | ? | ? | ? | ? | ? | ? | No |
pixelated | ? | 41 | ? | ? | 28 | ? | 4.0 |
optimizeQuality | ? | ? | ? | ? | ? | ? | No |
optimizeSpeed | ? | ? | ? | ? | ? | ? | No |
1. Supported as -webkit-optimize-contrast.