$.fn.imageCanvas = function() {
if (!document.getElementById('bgCanvas')){
$('body').append($('<canvas>',{id:'bgCanvas', width:'500px', height: '500px'}))
var canvas = document.getElementById('bgCanvas');
var ctx = canvas.getContext('2d');
}
var img = new Image();
img.onload = function() {
ctx.drawImage(img,0,0,438,300);
console.log(this.width);
console.log(this.height);
}
img.src= 'http://www.html5canvastutorials.com/demos/assets/darth-vader.jpg';
}
In ctx.drawImage i wrote x,y,width,height. But canvas stretches this Image. How can I image with original width/height