HTML canvas breedte eigenschap

Definitie en gebruik

width De eigenschap retourneert de breedte van het ImageData-object in pixels.

Tip:Raadpleeg createImageData()getImageData() and putImageData() Methods to learn more about the ImageData object.

Example

Output the width of the ImageData object:

alert("Width of imgData is: " + imgData.width);

Try it yourself

Syntax

imgData.width;

Technical details

Default value: #000000

Browser support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 9.0 3.6 4.0 10.1

Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.