Search code examples
javascriptjqueryimagebase64dimensions

Get image width and height from the Base64 code in JavaScript


I have a Base64 image encoded that you can find here. How can I get the height and the width of it?


Solution

  • var i = new Image();
    
    i.onload = function(){
      alert(i.width + ", " + i.height);
    };
    
    i.src = imageData;