CanvasRenderingContext2D: imageSmoothingQuality-Eigenschaft
Die imageSmoothingQuality
-Eigenschaft der
CanvasRenderingContext2D
-Schnittstelle, Teil der Canvas API, ermöglicht es Ihnen, die Qualität der Bildglättung festzulegen.
Hinweis:
Damit diese Eigenschaft Wirkung zeigt,
muss imageSmoothingEnabled
> true
sein.
Wert
Beispiele
Festlegen der Bildglättungsqualität
Dieses Beispiel verwendet die imageSmoothingQuality
-Eigenschaft mit einem skalierten Bild.
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_create_pattern.png";
img.onload = () => {
ctx.imageSmoothingQuality = "low";
ctx.drawImage(img, 0, 0, 300, 150);
};
Ergebnis
Spezifikationen
Specification |
---|
HTML # dom-context-2d-imagesmoothingquality-dev |
Browser-Kompatibilität
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.
Siehe auch
- Die Schnittstelle, die diese Eigenschaft definiert:
CanvasRenderingContext2D
CanvasRenderingContext2D.imageSmoothingEnabled
image-rendering