skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

  • Home
 
  • RSS
  • Twitter
Showing posts with label Java Image Examle. Show all posts
Showing posts with label Java Image Examle. Show all posts
Monday, October 22, 2012

Finding the difference between two images using their samples

Posted by Raju Gupta at 12:00 PM – 0 comments
 
Helps in finding the difference between two images by obtaining their samples and comparing them. The number of bands assosiated with each image is also compared, along with their width and height.

File file1 = new File("C:\Documents and Settings\515956\Desktop\Raj_image.jpg"); 
File file2 = new File("C:\Documents and Settings\515956\Desktop\Local_image.jpg");  
BufferedImage image1 = ImageIO.read(file1); 
BufferedImage image2 = ImageIO.read(file2);

Raster r1 = image1.getData();
Raster r2 = image2.getData(); 
boolean ret; // Stores result. 
// Check image sizes and number of bands. If there are different
// then no need to compare images as they are definitely not equal. 

System.out.println("image1 band"+r1.getNumBands()+"  image2 band"+r2.getNumBands()+"  image1 width"+r1.getWidth()+"  image2 width"+ r2.getWidth()+"  image1 height"+ r1.getHeight()+"  image2 height"+r2.getHeight()); 

if (r1.getNumBands() != r2.getNumBands() ||   r1.getWidth() != r2.getWidth() ||   r1.getHeight() != r2.getHeight()) {  
 ret = false;
 System.out.println("Primary comparison failure");

} 

else {  
 // #Bands and image bounds match so compare each sample in turn. 
 ret = true;   
 search:   
  for (int i=0; i<r1.getNumBands(); ++i) { 
   for (int x=0; x<r1.getWidth(); ++x) {    
    for (int y=0; y<r1.getHeight(); ++y) {  


     if (r1.getSample(x, y, i) != r2.getSample(x, y, i)) {     
      // At least one sample differs so result is false; 
      ret = false; 
      System.out.println("sample difference");
      // Use labeled break to terminate all loops.
      break
      search;   
     }   
    }    
   }   
  }   

}
System.out.println(ret);

[ Read More ]
Read more...
Tuesday, October 16, 2012

Picture Browser

Posted by Raju Gupta at 3:00 AM – 0 comments
 
This component lets user browse for pictures in his phone and select one

package mypackage;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.DeviceInfo;
import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.XYEdges;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.decor.Border;
import net.rim.device.api.ui.decor.BorderFactory;
import net.rim.device.api.ui.picker.FilePicker;

public class MyBrowseScreen extends MainScreen implements FilePicker.Listener{

 ButtonField browsePictures;
 private FilePicker _filePicker;
 BitmapField profilePictureField;
 Graphics graphics;
 Bitmap noImageBitmap = Bitmap.getBitmapResource("btn_discover.png");// any default bitmap to be displayed
 
 public MyBrowseScreen(){
  
  
  
  _filePicker = FilePicker.getInstance();
  _filePicker.setListener(this);
 
  profilePictureField = new BitmapField(noImageBitmap);
  profilePictureField.setBorder(BorderFactory.createRoundedBorder(
    new XYEdges(3, 3, 3, 3),
    Color.BLACK,100,
    Border.STYLE_FILLED));
  add(profilePictureField);
  
  browsePictures = new ButtonField("Browse",100){
   protected boolean navigationClick(int status, int time) {
    
    _filePicker.setTitle("Choose a picture");
    _filePicker.setView(FilePicker.VIEW_PICTURES);
    _filePicker.show();
    
    return super.navigationClick(status, time);
   }
  };
  
  add(browsePictures);
  
 }
 
 
 

 public void selectionDone(String selected) {
  

  if (selected != null && selected.length() > 0) {
   FileConnection fc;
   try {

    fc = (FileConnection) Connector.open(selected);
    InputStream is = fc.openDataInputStream();
    byte[] data_bytes = new byte[(int) fc.fileSize()];
    is.read(data_bytes);
    EncodedImage en_image = EncodedImage.createEncodedImage(data_bytes, 0, -1);
    Bitmap picture = en_image.getBitmap();
    
    // resize bitmap to bitmap field size
    picture = getResizedBitmap(noImageBitmap.getHeight(), noImageBitmap.getWidth(), en_image.getBitmap());

    is.close();
    fc.close();
    
    // in torch devices the image from camera gallery comes inverted so we need to rotate it
    if(selected.indexOf("camera")!=-1 && Integer.parseInt(DeviceInfo.getDeviceName().substring(0, 4)) == 9800){
     
     try {
      picture = rotateImage(picture, 90);
     } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     }
    }
    
    profilePictureField.setBitmap(picture);
    

    invalidate();
   } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }

  }

 }
 
 public void setBitmap(Bitmap profilePic){
 
  profilePic = getResizedBitmap(noImageBitmap.getHeight(),noImageBitmap.getWidth(),profilePic);
  profilePictureField.setBitmap(profilePic);
 }
 
 public static Bitmap getResizedBitmap(int resizeHeight, int resizeWidth,
   Bitmap bitmap) {

  Bitmap scaleBitmap = new Bitmap(resizeWidth, resizeHeight);
  bitmap.scaleInto(scaleBitmap, Bitmap.FILTER_BILINEAR);
  return scaleBitmap;

 }
 
  public static Bitmap rotateImage(Bitmap image, int angle) throws Exception
     {
      if(angle == 0)
      {
       return image; 
      }
      else if(angle != 180 && angle != 90 && angle != 270)
      {
       throw new Exception("Invalid angle");
      }
      
      int width = image.getWidth();
      int height = image.getHeight();
      
      Bitmap rotated = new Bitmap(width, height);
    
      int[] rowData = new int[width];
      int[] rotatedData = new int[width * height];
      
      int rotatedIndex = 0;
      
      for(int i = 0; i < height; i++)
      {
       image.getARGB(rowData, 0, width, 0, i, width, 1);
       
      
       for(int j = 0; j < width; j++)
       {
        rotatedIndex = 
         angle == 90 ? (height - i - 1) + j * height : 
         (angle == 270 ? i + height * (width - j - 1) : 
          width * height - (i * width + j) - 1
         );
      
        rotatedData[rotatedIndex] = rowData[j];
       }
      }
      
      if(angle == 90 || angle == 270)
      {
       rotated.setARGB(rotatedData, 0, width, 0, 0, width, height);
       return rotated;
      }
      else
      {
       rotated.setARGB(rotatedData, 0, width, 0, 0, height, width);
       return rotated; 
      }
     }


 
}


[ Read More ]
Read more...

Cropping of image using Java

Posted by Raju Gupta at 12:00 AM – 0 comments
 
When a user wants to set a picture as profile pic he will need the functionaly for cropping the picture.

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.TouchEvent;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.container.MainScreen;

public final class MyCropScreen extends MainScreen {
 
 Graphics graphics;
 int initialLeftPoint = 80;
 
 int touchX ;
 int touchY ;

 int crop_rectangle_x[] = new int[4];
 int crop_rectangle_y[] = new int[4];

 int crop_rect_width;

 int pointerToPoint;

 Bitmap picture;

 ButtonField save;
 BitmapField field;

 boolean downInsideCropArea = false;
 boolean onCropLine = false;
 int lastMovePointSize = 0;

 
 /**
  * 
  * @param bitmap bitmap to be cropped
  * @param browseScreenInstance  screen instance to which cropped bitmap is to be set
  */
 public MyCropScreen(final Bitmap bitmap, final MyBrowseScreen browseScreenInstance) {

  picture = bitmap;
  Bitmap blank_surface = new Bitmap(Bitmap.getDefaultType(),
    picture.getWidth(), picture.getHeight());
  graphics = Graphics.create(blank_surface);
  graphics.drawBitmap(0, 0, picture.getWidth(), picture.getHeight(),
    picture, 0, 0);

  crop_rectangle_x[0] = crop_rectangle_x[3] = initialLeftPoint;
  crop_rectangle_x[1] = crop_rectangle_x[2] = Display.getWidth() - initialLeftPoint;

  crop_rectangle_y[0] = crop_rectangle_y[1] = (Display.getHeight() - (crop_rectangle_x[2] - crop_rectangle_x[0])) / 2;
  crop_rectangle_y[2] = crop_rectangle_y[3] = crop_rectangle_y[0] + (crop_rectangle_x[2] - crop_rectangle_x[0]);

  graphics.drawOutlinedPath(crop_rectangle_x, crop_rectangle_y, null, null, true);

  crop_rect_width = crop_rectangle_x[1] - crop_rectangle_x[0];

  field = new BitmapField(blank_surface) {
   protected boolean touchEvent(TouchEvent message) {

    int eventCode = message.getEvent();
    
    
    if(eventCode == TouchEvent.DOWN ){
     
     // Get the screen coordinates of the touch event
     
     touchX = message.getX(1);
     touchY = message.getY(1);
    }

    if (eventCode == TouchEvent.DOWN || downInsideCropArea
      || onCropLine) {

     if ((onCropLine || onTheCropLine(touchX, touchY)) && !downInsideCropArea) {

      onCropLine = true;

      if (eventCode == TouchEvent.MOVE) {

       System.out.println(" inside move");
       int size = message.getMovePointsSize();

       int moveX[] = new int[size];
       int moveY[] = new int[size];

       message.getMovePoints(1, moveX, moveY,
         new int[size]);

       if (size == 1) {

        cropPoints(moveX[0], moveY[0], touchX, touchY);
        

         graphics.clear();
         graphics.drawBitmap(0, 0,
           picture.getWidth(),
           picture.getHeight(), picture, 0, 0);
         graphics.drawOutlinedPath(crop_rectangle_x, crop_rectangle_y, null, null,
           true);
         invalidate();

        
       }

       for (int i = lastMovePointSize; i < size
         && size > 1; i++) {

        cropPoints(moveX[i], moveY[i], moveX[i - 1],
          moveY[i - 1]);

        

         graphics.clear();
         graphics.drawBitmap(0, 0,
           picture.getWidth(),
           picture.getHeight(), picture, 0, 0);
         graphics.drawOutlinedPath(crop_rectangle_x, crop_rectangle_y, null, null,
           true);
         invalidate();

        
       }

       lastMovePointSize = size;
       System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + ","
         + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
       System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + ","
         + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);
       System.out.println("ON CROP MOVE");

      }else{
       System.out.println(" outside move on crop event code is "+eventCode);
      }

     } else {

      if (downInsideCropArea || insideCropRect(touchX, touchY)) {

       downInsideCropArea = true;

       
       if (eventCode == TouchEvent.MOVE) {

        int size = message.getMovePointsSize();

        int moveX[] = new int[size];
        int moveY[] = new int[size];

        message.getMovePoints(1, moveX, moveY,
          new int[size]);

        if (size == 1) {

         int movementX = moveX[0] - touchX;
         int movementY = moveY[0] - touchY;
         
         int x_new[] = { crop_rectangle_x[0] + movementX,
           crop_rectangle_x[0] + movementX + crop_rect_width,           
           crop_rectangle_x[0] + movementX + crop_rect_width,
           crop_rectangle_x[0] + movementX };
         int y_new[] = { crop_rectangle_y[0] + movementY,
           crop_rectangle_y[0] + movementY ,
           crop_rectangle_y[0] + movementY + crop_rect_width,           
           crop_rectangle_y[0] + movementY + crop_rect_width};
         
         
         
         if (isPointInsidePicture(x_new, y_new)) {

        
          crop_rectangle_x = x_new;
          crop_rectangle_y = y_new;
          graphics.clear();
          graphics.drawBitmap(0, 0,
            picture.getWidth(),
            picture.getHeight(), picture,
            0, 0);
          graphics.drawOutlinedPath(crop_rectangle_x, crop_rectangle_y, null,
            null, true);
          invalidate();

         }

        }

        for (int i = lastMovePointSize; i < size
          && size > 1; i++) {

         int movementX = moveX[i] - moveX[i - 1];
         int movementY = moveY[i] - moveY[i - 1];
         
         int x_new[] = { crop_rectangle_x[0] + movementX,
           crop_rectangle_x[0] + movementX + crop_rect_width,           
           crop_rectangle_x[0] + movementX + crop_rect_width,
           crop_rectangle_x[0] + movementX };
         int y_new[] = { crop_rectangle_y[0] + movementY,
           crop_rectangle_y[0] + movementY ,
           crop_rectangle_y[0] + movementY + crop_rect_width,           
           crop_rectangle_y[0] + movementY + crop_rect_width};
         
         
         
         if (isPointInsidePicture(x_new, y_new)) {

          crop_rectangle_x = x_new;
          crop_rectangle_y = y_new;

         System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + ","
           + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
         System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + ","
           + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);
         System.out.println(movementX + ","
           + movementY);

        

          graphics.clear();
          graphics.drawBitmap(0, 0,
            picture.getWidth(),
            picture.getHeight(), picture,
            0, 0);
          graphics.drawOutlinedPath(crop_rectangle_x, crop_rectangle_y, null,
            null, true);
          invalidate();

         }

        }

        lastMovePointSize = size;
       }

      } else {
       lastMovePointSize = 0;
       downInsideCropArea = false;
      }
     }
    }

    if (eventCode == TouchEvent.UP) {
     lastMovePointSize = 0;
     downInsideCropArea = false;
     onCropLine = false;
    }

    

    return true;
   }
  };
  add(field);

  MenuItem crop = new MenuItem("crop", 0, 0) {

   public void run() {

    Bitmap croppedBitmap = cropImage(bitmap, crop_rectangle_x[0], crop_rectangle_y[0],
      (crop_rectangle_x[2] - crop_rectangle_x[0]), (crop_rectangle_y[3] - crop_rectangle_y[0]));
    browseScreenInstance.setBitmap(croppedBitmap);
    UiApplication.getUiApplication().popScreen(MyCropScreen.this);
   };
  };

  addMenuItem(crop);

 }

 
 // This method determines what the next crop points should be
 public void cropPoints(int movementX, int movementY, int touchX, int touchY) {

  int diff = 0;

  if ((touchX < crop_rectangle_x[0] + 3 && touchX > crop_rectangle_x[0] - 5)) {

   if (movementX >= 1) {
    
    diff = crop_rectangle_x[0] - movementX;
    crop_rectangle_x[0] = crop_rectangle_x[3] = movementX;
    crop_rectangle_y[0] = crop_rectangle_y[1] = crop_rectangle_y[0] - diff;
    crop_rectangle_x[1] = crop_rectangle_x[2] = crop_rectangle_x[2] + diff;
    crop_rectangle_y[2] = crop_rectangle_y[3] = crop_rectangle_y[2] + diff;
   }
   

   System.out.println("diff " + diff + "move x " + movementX);
   System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + "," + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
   System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + "," + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);

  } else if ((touchX < crop_rectangle_x[1] + 3 && touchX > crop_rectangle_x[1] - 5)) {

   if (movementX <= (Display.getWidth() - 1)) {
    
    diff = crop_rectangle_x[1] - movementX;
    crop_rectangle_x[0] = crop_rectangle_x[3] = crop_rectangle_x[0] + diff;
    crop_rectangle_y[0] = crop_rectangle_y[1] = crop_rectangle_y[0] + diff;
    crop_rectangle_x[1] = crop_rectangle_x[2] = movementX;
    crop_rectangle_y[2] = crop_rectangle_y[3] = crop_rectangle_y[2] - diff;
   }
   
   System.out.println("diff " + diff + "move x " + movementX);
   System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + "," + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
   System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + "," + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);

  } else if ((touchY < crop_rectangle_y[0] + 3 && touchY > crop_rectangle_y[0] - 5)) {

   if(movementY >= 1){
    
    diff = crop_rectangle_y[0] - movementY;
    crop_rectangle_x[0] = crop_rectangle_x[3] = crop_rectangle_x[0] - diff;
    crop_rectangle_y[0] = crop_rectangle_y[1] = movementY;
    crop_rectangle_x[1] = crop_rectangle_x[2] = crop_rectangle_x[2] + diff;
    crop_rectangle_y[2] = crop_rectangle_y[3] = crop_rectangle_y[2] + diff;

   }
   
   System.out.println("diff " + diff + "move x " + movementY);
   System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + "," + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
   System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + "," + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);

  } else if ((touchY < crop_rectangle_y[2] + 3 && touchY > crop_rectangle_y[2] - 5)) {

   if(movementY <= (Display.getHeight() - 1)){
   
    diff = crop_rectangle_y[2] - movementY;
    crop_rectangle_x[0] = crop_rectangle_x[3] = crop_rectangle_x[0] + diff;
    crop_rectangle_y[0] = crop_rectangle_y[1] = crop_rectangle_y[0] + diff;
    crop_rectangle_x[1] = crop_rectangle_x[2] = crop_rectangle_x[2] - diff;
    crop_rectangle_y[2] = crop_rectangle_y[3] = movementY;
   }
   

   System.out.println("diff " + diff + "move x " + movementY);
   System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + "," + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
   System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + "," + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);

  }

  crop_rect_width = crop_rectangle_x[1] - crop_rectangle_x[0];
 }

 // This method determines if the touched point is inside the given picture or not
 public boolean isPointInsidePicture(int x[], int y[]) {

  if (x[0] >= 1 && x[1] <= (Display.getWidth() - 1) && y[0] >= 1
    && y[2] <= (Display.getHeight() - 1)) {

   return true;
  }

  return false;
 }

 // This method determines if the touched point is inside the crop rectangle or not
 public boolean insideCropRect(int touchX, int touchY) {

  if (crop_rectangle_x[0] < touchX && crop_rectangle_x[1] > touchX && crop_rectangle_y[0] < touchY && crop_rectangle_y[2] > touchY) {
   System.out.println("inside rect");
   return true;

  }
  
  System.out.println("outside rect");
  System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + ","
    + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
  System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + ","
    + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);
  return false;
 }

 // This method determines if the touched point is on the crop rectangle or not
 public boolean onTheCropLine(int touchX, int touchY) {

  if ((touchX < crop_rectangle_x[0] + 3 && touchX > crop_rectangle_x[0] - 5)
    || (touchX < crop_rectangle_x[1] + 3 && touchX > crop_rectangle_x[1] - 5)
    || (touchY < crop_rectangle_y[0] + 3 && touchY > crop_rectangle_y[0] - 5)
    || (touchY < crop_rectangle_y[2] + 3 && touchY > crop_rectangle_y[2] - 5)) {
   
   
   System.out.println("on crop region");
   return true;

  }
  System.out.println("outside crop"+touchX+" ,"+touchY);
  System.out.println(crop_rectangle_x[0] + "," + crop_rectangle_x[1] + ","
    + crop_rectangle_x[2] + "," + crop_rectangle_x[3]);
  System.out.println(crop_rectangle_y[0] + "," + crop_rectangle_y[1] + ","
    + crop_rectangle_y[2] + "," + crop_rectangle_y[3]);
  return false;
 }

 // This method returns the image after cropping
 public Bitmap cropImage(Bitmap image, int x, int y, int width, int height) {
  Bitmap result = new Bitmap(width, height);
  Graphics g = Graphics.create(result);
  g.drawBitmap(0, 0, width, height, image, x, y);
  return result;
 }
}

[ Read More ]
Read more...
Older Posts
Subscribe to: Posts ( Atom )

List of Java Programs

  • Java Program to check Greater between the Two Number
  • Java Program to find that given number is Palindrome or not
  • Java Program to Demonstrate the Use of Pre and Post Operator
  • Java Program to Reverse the Given Number
  • Java Program to Print Number in the Given Data Type
  • Program to Demonstrate Skipping using Continue
  • Program to find whether entered character is a vowel or Consonant
  • Java Program to Calculate the Sum of Digits of Given Number
  • How to swap two numbers using only two variables
  • Checking the Given Number is Armstrong or Not
  • Average an Array of Values
  • Display ASCII Code Instead of Character
  • Comparison of Two Variable using If
  • Printing Table In java using While Loop
  • Generate Random Number Using Math.Random Function
  • To Find roots of Quadratic Equation
  • Performing Arithmetic Opration on Two Variable
  • Concatenation of Two String in Java
  • Command Line Argument in JAVA
  • Java Hello World Program
  • Calculate Circle Perimeter | Java Program
  • Calculate the Area of Circle | Java Program
  • To Find Whether Given Year is a Leap Year or not
  • Popular
  • Recent
  • Archives

Total Pageviews

Sparkline

Followers

Popular Posts of This Week

  • Barcodes Encoding Decoding Java Example
    General Overview of BarCodes and using them to encode and decode BitMatrix bitMatrix = null;// initialize bitMatrix = new PDF417Writer()....
  • To Sort an Interger Array using Shell Sort
    To Sort an Interger Array using Shell Sort class ShellSort { public static int[] shellSort(int[] array) { int N = array.length; ...
  • Count the PDF Pages using Java
    To get number of pages in the PDF import java.io.*; import com.lowagie.text.pdf.PdfReader; public class PDFSize { //static String P...
  • Power of Java Reflection API
     Reflection API is part of core java. This is the most powerful API that java has ever  produced. Reflection is the powerful technique a...
  • program to retrieve Method names of a class
    import java.lang.reflect.*; public class Refl6 { public static void main(String args[]) throws Exception { Class c=Class.forN...
  • Send outlook meeting request using Java Mail API
    This Program is useful to send meeting request to the users using Java mail API.We need to include mail.jar in the classpath. import ja...
  • Sending mail through java API
    if the SMTP host is connecting, then only we can send the mails. And more over API jars are necessary public void sendEmailCommPaymentD...
  • Java Program to Print Number in the Given Data Type
    Here is Java Program to print number given in the data types public class second{ public static void main(String[] args){ int n; ...
  • Verifying in Runtime that dose the class exists within a program
    public class Main { public static boolean doesClassExist(String name) { try { Class c = Class.forName(name); i...
  • Craeting Thumnails from images
    This code sniipet will tell us how to create thumbnails from images through java code private void createThumbnail(String filename, i...
Powered by Blogger.

Archives

  • ▼  2014 ( 4 )
    • ▼  August ( 4 )
      • Java program to create a Binary Heap and Perform v...
      • Create an Adjacency matrix Graph and perform Add a...
      • To Sort an Interger Array using Shell Sort
      • Sort an Integer array with Bucket Sort
  • ►  2013 ( 6 )
    • ►  August ( 1 )
    • ►  April ( 5 )
  • ►  2012 ( 673 )
    • ►  November ( 9 )
    • ►  October ( 223 )
    • ►  September ( 272 )
    • ►  August ( 2 )
    • ►  June ( 1 )
    • ►  February ( 67 )
    • ►  January ( 99 )
 

Our Blogs

  • Linux Tutorial
  • C Programming Tutorial

Labels

  • Agile Methodology ( 1 )
  • Algorithm ( 3 )
  • AntiSamy ( 1 )
  • Arithmetic Operation ( 1 )
  • Array Example ( 9 )
  • ArrayList Examples ( 11 )
  • Average an Array of Values ( 1 )
  • Barcode Example ( 1 )
  • Basic Java Programs ( 34 )
  • Bing API Example ( 2 )
  • BitSet Example ( 1 )
  • Boolean Example ( 1 )
  • Bouncy Castle API ( 1 )
  • Break Statement ( 2 )
  • BufferedReader Example ( 2 )
  • Calendar Example ( 1 )
  • Chart Generation Example ( 1 )
  • Command Line Argument ( 1 )
  • Comparator Example ( 1 )
  • Concatenation of String ( 1 )
  • Continue Statement ( 1 )
  • Control Structure ( 1 )
  • Copy File Example ( 1 )
  • CRC Example ( 1 )
  • CSV Example ( 6 )
  • Data Structure ( 5 )
  • Date Example ( 2 )
  • Directory Example ( 1 )
  • Do - While Loop Example ( 1 )
  • Domino Database ( 1 )
  • Email Example ( 8 )
  • Encryption Example ( 3 )
  • Excel Example ( 15 )
  • Factorial Example ( 1 )
  • File Upload Example ( 1 )
  • Find Roots of Quadratic Equation ( 1 )
  • FTP Example ( 2 )
  • Graph Examples ( 1 )
  • Greater between Two Numbers ( 1 )
  • GSON Library ( 1 )
  • HashMap Example ( 1 )
  • HashSet Example ( 1 )
  • Hello World Program ( 1 )
  • If Condition ( 2 )
  • Inner Class Example ( 1 )
  • iText Example ( 3 )
  • JAR File ( 1 )
  • JAVA Applet ( 1 )
  • Java Applications ( 1 )
  • Java AWT Example ( 9 )
  • Java Certification ( 1 )
  • Java Class Examples ( 15 )
  • Java Collection Example ( 1 )
  • Java Command Example ( 4 )
  • Java Constructor Examples ( 1 )
  • Java Currency Example ( 1 )
  • Java Database Example ( 3 )
  • Java Date and Time Example ( 3 )
  • Java DateFormat Example ( 3 )
  • Java Examples ( 2 )
  • Java Exception Example ( 5 )
  • Java File Example ( 22 )
  • Java GUI Example ( 1 )
  • Java Image Examle ( 3 )
  • Java Inheritance Example ( 3 )
  • Java Input Output Example ( 1 )
  • Java IO Example ( 3 )
  • Java Jar Example ( 1 )
  • Java JSON Example ( 3 )
  • Java Mail Examples ( 4 )
  • Java Map Example ( 5 )
  • Java MapReduce Example ( 2 )
  • Java MultiThreading Example ( 7 )
  • Java Network Example ( 9 )
  • Java Package ( 1 )
  • Java Programs ( 1 )
  • Java RMI ( 1 )
  • Java Robot Class Examples ( 2 )
  • Java Runtime Example ( 1 )
  • Java Swing Example ( 9 )
  • Java Util Example ( 1 )
  • Java Vector Example ( 4 )
  • Java Voice Example ( 1 )
  • Java Webservice Example ( 1 )
  • Java XML Example ( 3 )
  • Java Zip Class Examples ( 2 )
  • JDBC ( 9 )
  • JDK Version Comparison ( 1 )
  • JFrame Example ( 3 )
  • JOptionPane Dialog Example ( 1 )
  • JPanel Example ( 1 )
  • JSP Example ( 2 )
  • JSTL Example ( 1 )
  • jUnit Example ( 2 )
  • LinkedList Example ( 2 )
  • List Example ( 1 )
  • Long Variable ( 1 )
  • Lottery Nubmer ( 1 )
  • MD5 Hashing Example ( 3 )
  • Memory Management Example ( 1 )
  • Method Override ( 1 )
  • MIDI Sound ( 8 )
  • Module Operator Example ( 2 )
  • Multiplication Table ( 1 )
  • Observer Interface Example ( 1 )
  • Operator Example ( 5 )
  • Pagination ( 1 )
  • Palindrome Number ( 1 )
  • Pass By Reference Example ( 1 )
  • Pass By Value Example ( 1 )
  • PDF File Example ( 3 )
  • PDF Generation Example ( 4 )
  • Pre and Post Operator ( 2 )
  • Prime Number ( 3 )
  • Progress Bar Example ( 1 )
  • Property List Example ( 2 )
  • Random Function ( 7 )
  • Recursion Example ( 2 )
  • Regex Example ( 2 )
  • Remote Host Example ( 2 )
  • Robot Class ( 4 )
  • Searching Example ( 3 )
  • Slideshow ( 1 )
  • Sorting Example ( 7 )
  • SpringLayout Example ( 1 )
  • Stack Example ( 4 )
  • Static Variable ( 1 )
  • StreamTokenizer Example ( 2 )
  • String Example ( 19 )
  • Struts2 Example ( 1 )
  • Sum of Digits ( 1 )
  • Swap Two Numbers ( 1 )
  • Switch Case ( 3 )
  • Tapestry Components ( 1 )
  • Thumbnail Example ( 2 )
  • TimerTask Example ( 2 )
  • To Calculate Volume ( 1 )
  • To Check Armstrong Number ( 1 )
  • Tree Example ( 1 )
  • TreeMap Example ( 1 )
  • TreeSet Example ( 1 )
  • Two Dimensional Array Example ( 1 )
  • UUID ( 1 )
  • Validation Example ( 2 )
  • Variable Casting ( 1 )
  • While Loop ( 1 )
  • XML Parsing ( 7 )
  • XSS Attacks ( 1 )
  • Zip File ( 15 )

Popular Posts

  • Creating Dynamic Macro Enabled Excel by Java
    We can create a dynamic macro enabled excel by java: We need to create a excel sheet template with macro on server. we can copy the...
  • Java program to create a Binary Heap and Perform various operation
    A binary heap (min-heap) is a complete binary tree with elements from a partially ordered set, such that the element at every node is less ...
  • To Sort an Interger Array using Shell Sort
    To Sort an Interger Array using Shell Sort class ShellSort { public static int[] shellSort(int[] array) { int N = array.length; ...
  • Implementation of a basic generic tree, with labels of type T - Data Structure
    // This implements a basic generic tree, with labels of type T, // pointer to the parent node, and a singly linked list of children nodes...
  • Create an Adjacency matrix Graph and perform Add and Remove operation
    import java.util.ArrayList; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import...
  • Printing Table In java using While Loop
    Here is a Java Program to Print the Table public class Table { public static void main(String[] args) { int no = Integer.p...
  • Merge-Sort Algorithm implementation in JAVA
    Merge-Sort Function void MergeSort(int low, int high) // a[low : high] is a global array to be sorted. // Small(P) is true if there...
  • Sort an Integer array with Bucket Sort
    Here is a java program to Sort an Integer array with Bucket Sort class BucketSort { public int[] bucketSort(int[] array) { /...
  • Stack implemented as array - Data Structure
    // Stack implemented as array public class ArrayStack<T> { private T[] stack; private int numElements = 0; // points to s...
  • Java Program to Generate the Lottery Number between 1 to 49
     A lottery requires that you select six different numbers from the integers 1 to 49. Write a program to do this for you and generate five s...
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger