Get the original dimensions of a modified html image element
1 answer
Attributes naturalWidth
and naturalHeight
DOM are present here .
For example:
var image = new Image();
image.src = "test.jpg";
image.onload = function() {
alert('width - ' + image.naturalWidth);
alert('height - ' + image.naturalHeight);
}
Or see an example on jsFiddle.
More information on MDN
+17
source to share