files/en-us/web/css/reference/properties/image-rendering/index.md
The image-rendering CSS property sets an image scaling algorithm. The property applies to an element itself, to any images set in its other properties, and to its descendants.
{{InteractiveExample("CSS Demo: image-rendering")}}
image-rendering: auto;
image-rendering: smooth;
image-rendering: crisp-edges;
image-rendering: pixelated;
<section id="default-example">
</section>
#example-element {
height: 480px;
object-fit: cover;
}
The {{Glossary("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.
/* Keyword values */
image-rendering: auto;
image-rendering: smooth;
image-rendering: crisp-edges;
image-rendering: pixelated;
/* Global values */
image-rendering: inherit;
image-rendering: initial;
image-rendering: revert;
image-rendering: revert-layer;
image-rendering: unset;
auto
smooth
crisp-edges
pixelated
[!NOTE] The values
optimizeQualityandoptimizeSpeedpresent in an early draft (and coming from its SVG counterpart {{SVGAttr("image-rendering")}}) are defined as synonyms for thesmoothandpixelatedvalues respectively.
[!NOTE] The CSS images module defines a
high-qualityvalue for theimage-renderingproperty to provide a preference for higher-quality scaling, however, this is not supported in any browsers.
{{cssinfo}}
{{csssyntax}}
In this example, an image is repeated three times, with each having a different image-rendering value applied.
<div>
</div>
img {
height: 200px;
}
.auto {
image-rendering: auto;
}
.smooth {
image-rendering: smooth;
}
.pixelated {
image-rendering: pixelated;
}
.crisp-edges {
image-rendering: crisp-edges;
}
{{EmbedLiveSample('Setting_image_scaling_algorithms', 260, 260)}}
{{Specifications}}
{{Compat}}