Skip to content
Advertisement

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?

Advertisement

Answer

var i = new Image();

i.onload = function(){
  alert(i.width + ", " + i.height);
};

i.src = imageData;
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement