Monday, 27 July 2015

How to fetch high definition photo in Lower size Using HTML Canvas ?

<!DOCTYPE HTML>
<html>
  <head>

    <style>
      body {
        margin: 0px;
        padding: 0px;
      }
    </style>
  </head>
  <body>
    <canvas id="myCanvas" width="578" height="200"></canvas>
    <script>
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');
      var x = 188;
      var y = 30;
      var width = 140;
      var height = 137;
      var imageObj = new Image();

      imageObj.onload = function() {
        context.drawImage(imageObj, x, y, width, height);
      };
      imageObj.src = 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLY6YAS7bFg27wgNRl5Z4FMK3kKKv6O48zN57fmUUVHP0NKfLOI3Ra-GUSG4TWfWTJc3vrK2xvTfNCsag987tMYxkVnW66BYeU2iglQSwD4zF5zRMnIDXIv72weSFz11SJ3uhJNT7_1hy4/s1600/IMG_20141222_124322382.jpg';
    </script>
  </body>
</html>



It will Show as..



No comments:

Post a Comment