CanvasRenderingContext2D: imageSmoothingQuality プロパティ
imageSmoothingQuality
は CanvasRenderingContext2D
インターフェイスのプロパティで、キャンバス API の一部です。画像の平滑化の品質を設定します。
メモ:
このプロパティが効果を発揮するには、imageSmoothingEnabled
が true
でなければなりません。
値
例
画像の平滑化の品質を設定する
この例では、拡大縮小する画像で imageSmoothingQuality
プロパティを用います。
HTML
html
<canvas id="canvas"></canvas>
JavaScript
js
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
let img = new Image();
img.src = "canvas_createpattern.png";
img.onload = () => {
ctx.imageSmoothingQuality = "low";
ctx.drawImage(img, 0, 0, 300, 150);
};
結果
仕様書
Specification |
---|
HTML # dom-context-2d-imagesmoothingquality-dev |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
imageSmoothingQuality |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- このプロパティを定義しているインターフェイス:
CanvasRenderingContext2D
CanvasRenderingContext2D.imageSmoothingEnabled
image-rendering