Web ImageData API | ImageData.height property

The ImageData.height property is used to return the height attribute of ImageData object. The ImageData() is used to create an object of given size.

Syntax:

imageData.height

Example:




<!DOCTYPE html> 
<html
  
<head>
    <title>
        Web ImageData API | ImageData.height property
    </title>
  
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green;"
        w3wiki 
    </h1
                  
    <h2>ImageData height property</h2>
  
    <button onclick="getheight();">
        Get height
    </button>
      
    <p id='height'></p>
  
    <script type="text/javascript">
        function getheight () {
        let imageData = new ImageData(100, 100);
            document.getElementById('height').innerHTML
                    = imageData.height;
        }
    </script
</body>
  
</html>


Output:

  • Before Click the Button:
  • After Click the Button:

Supported Browsers: The browsers supported by Web API ImageData | ImageData.height property are listed below:

  • Google Chrome
  • Internet Explorer 9
  • Firefox 14
  • Safari 3.1
  • Opera 9