HTML canvas imageData height Property

❮ HTML canvas Reference

Example

// Accessing the element
let c = document.getElementById("myCanvas");

let ctx = c.getContext("2d");
let imgData = ctx.createImageData(100, 100);

// Creating function
function myFunction(){
  alert("Height of imgData is: " + imgData.height);
}

Meaning

The imageData height canvas property returns the height of an ImageData object.


Standard Syntax

JavaScript syntax:

context.imageData.height;



Browser Support




Status







Return Values

Value Description
number Returns in pixels.
❮ HTML canvas Reference