Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.     public static void writeImage(BufferedImage image, File file) throws IOException {
  2.         //Slow
  3.         ImageIO.write(image, "PNG", file);
  4.  
  5.         //Mildly faster
  6.         BufferedOutputStream imageOutputStream = new BufferedOutputStream(new FileOutputStream(file));
  7.         ImageIO.write(image, "PNG", imageOutputStream);
  8.         imageOutputStream.close();
  9.     }