I have design a canvas now I want to call a image in that canvas. I have gone through the tutorials but I don't know how to implement that. My image is high resolution but I want to reduce that image size and resolution with javascript. Anybody will help me.
<canvas id="myCanvas" width="600" height="400" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.moveTo(8,200);
ctx.lineTo(8,308);
ctx.moveTo(259,76);
ctx.lineTo(259,308);
ctx.moveTo(259,308);
ctx.lineTo(8,308);
ctx.moveTo(8,200);
ctx.lineTo(259,76);
ctx.stroke();
var imageObj = new Image();
imageObj.onload = function() {
ctx.drawImage(imageObj, 69, 50);
};
imageObj.src = 'img/logo.jpg', height='42', width='42';
</script>
I am not able to call image. Anybody will help me how to convert this javascript in jquery?
Thanks