Canvas width attribute

Definition and Usage

width The property returns the width of the ImageData object in pixels.

Tip:See also 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 to fully support this property.

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

Σημείωση:Ο Internet Explorer 8 και οι προηγούμενες εκδόσεις δεν υποστηρίζουν το στοιχείο <canvas>.