cachaito
6/23/2015 - 2:48 PM

Getting size of image

/*
  HTML:
    <img src="https://placekitten.com/g/400/600" width="300" height="450">
  
  CSS:
    img {
      width: 299px;
      height: 449px;
    }
*/

var c = getComputedStyle(myImg).getPropertyValue('width'), // 299
    w = myImg.width, // 299
    a = myImg.getAttribute('width'), // 300
    n = myImg.naturalWidth; // 400