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..



Tuesday, 21 July 2015

How to create Thumbnail image in Java?

Download thumbnailator-0.4.8.jar from link

then open cmd.exe

set classpath=.../thumbnailator-0.4.8.jar;.
 

Then run the folowing program....


       
/*
*Auther@jyotiprakash panigrahi
*/
import net.coobird.thumbnailator.*;
public class thumbnail
{
public static void main(String args[])throws Exception
{
Thumbnails.of("1.jpg")
        .size(250, 250)
        .toFile("thumbnail.jpg");
}
}