Answers for "get image src width and height"

2

javascript get image width and height

var img = new Image();
img.onload = function() {
  alert(this.width + 'x' + this.height);
}
img.src = 'http://www.google.com/intl/en_ALL/images/logo.gif';
Posted by: Guest on March-04-2020
0

get image src width and height

// for the original width and height in px of the source
image.naturalWidth, image.naturalHeight

// for the image size in px rendered on the screen
image.width, image.height
Posted by: Guest on April-21-2022

Code answers related to "get image src width and height"

Code answers related to "Javascript"

Browse Popular Code Answers by Language