document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.awt.image.*;  
  2.   import javax.imageio.*;  
  3.   import java.io.*;  
  4.   /**  
  5.   * @author Rafif Ridho
  6.   * @version 1.0  
  7.   */  
  8.   public class ImageFileManager  
  9.   {    
  10.    private static final String IMAGE_FORMAT = "jpg";  
  11.    public static OFImage loadImage(File imageFile)  
  12.    {  
  13.     try {  
  14.      BufferedImage image = ImageIO.read(imageFile);  
  15.      if(image == null || (image.getWidth(null) < 0)) {    
  16.       return null;  
  17.      }  
  18.      return new OFImage(image);  
  19.     }  
  20.     catch(IOException exc) {  
  21.      return null;  
  22.     }  
  23.    }  
  24.    public static void saveImage(OFImage image, File file)  
  25.    {  
  26.     try {  
  27.      ImageIO.write(image, IMAGE_FORMAT, file);  
  28.     }  
  29.     catch(IOException exc) {  
  30.      return;  
  31.     }  
  32.    }  
  33.   }
');