CSS画像レンダリングプロパティ
例
画像スケーリングに使用できるさまざまなアルゴリズムを示します。
.image {
height: 100px;
width: 100px;
image-rendering: auto;
}
.crisp-edges {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
.pixelated {
image-rendering: pixelated;
}
.smooth {
image-rendering: smooth;
}
.high-quality {
image-rendering: high-quality;
}
定義と使用法
このimage-rendering
プロパティは、画像スケーリングに使用されるアルゴリズムのタイプを指定します。
注:このプロパティは、拡大縮小されていない画像には影響しません。
デフォルト値: | 自動 |
---|---|
遺伝性の: | はい |
アニメート可能: | 番号。アニメート可能について読む |
バージョン: | CSS3 |
JJavaScript構文: | object .style.imageRendering = "pixelated" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
image-rendering | 41.0 | 79.0 | 65.0 | 10.0 | 28.0 |
Chrome、Edge、Opera、およびSafariは、値に別名を使用し
crisp-edges
ます:-webkit-optimize-contrast
。
CSS構文
image-rendering: auto|smooth|high-quality|crisp-edges|pixelated|initial|inherit;
プロパティ値
Value | Description |
---|---|
auto | Let the browser choose the scaling algorithm. This is default |
smooth | Use an algorithm that smooth out the colors in the image |
high-quality | Same as smooth, but with a preference for higher-quality scaling |
crisp-edges | Use an algorithm that will preserve the contrast and edges in the image |
pixelated | If the image is scaled up, the nearest-neighbor algorithm is used, so the image will appear as being composed of large pixels. If the image is scaled down, it will be the same as auto |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |