Java: save a BufferedImage to PNG or JPG using Image IO








public static void saveAsPNG(BufferedImage img, File f) {

    ImageIO.write(img, "PNG", f);

}

public static void saveAsJPG(BufferedImage img, File f) {

    ImageIO.write(img, "JPG", f);

}



No comments:

Post a Comment