CanvasRenderingContext2D: imageSmoothingQuality プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
imageSmoothingQuality は CanvasRenderingContext2D インターフェイスのプロパティで、キャンバス API の一部です。画像の平滑化の品質を設定します。
メモ: このプロパティが効果を発揮するには、imageSmoothingEnabled が true でなければなりません。
値
以下のいずれかです。
既定値は "low" です。
例
>画像の平滑化の品質を設定する
この例では、拡大縮小する画像で 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> |
ブラウザーの互換性
関連情報
- このプロパティを定義しているインターフェイス:
CanvasRenderingContext2D CanvasRenderingContext2D.imageSmoothingEnabledimage-rendering