public static void saveImage(BufferedImage im, String filename) {
		try
        {
           ImageIO.write(im, "png", new File(filename));
        }
        catch (IOException e1)
        {
           System.out.println("Could not write the image file.");
        }
	}