Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.awt.image.BufferedImage;
  2. import java.io.File;
  3.  
  4. import javax.imageio.ImageIO;
  5.  
  6. public class ImageManager {
  7.     private static final String IM_STRING = "jpg";
  8.    
  9.     public static Imagest loadImage(File imageFile) {
  10.         try {
  11.             BufferedImage image = ImageIO.read(imageFile);
  12.             if (image == null || (image.getWidth(null)<0)) {
  13.                 return null;
  14.             }
  15.             return new Imagest(image);
  16.         } catch (Exception e) {
  17.             return null;
  18.         }
  19.     }
  20.    
  21.     public void saveImage(Imagest image, File file) {
  22.         try {
  23.             ImageIO.write(image, IM_STRING, file);
  24.         } catch (Exception e) {
  25.             // TODO: handle exception
  26.         }
  27.     }
  28. }