Here you can find the source of encodePNG(BufferedImage image, String pathAndFileName)
public static void encodePNG(BufferedImage image, String pathAndFileName)
//package com.java2s; /*// w w w . ja va 2 s. c om * $Id: PixelUtil.java,v 1.3 2007/01/29 09:08:46 eiki Exp $ Created on May 29, * 2006 * * Copyright (C) 2006 Idega Software hf. All Rights Reserved. * * This software is the proprietary information of Idega hf. Use is subject to * license terms. */ import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; public class Main { public static void encodePNG(BufferedImage image, String pathAndFileName) { try { ImageIO.write(image, "png", new File(pathAndFileName)); } catch (Exception e) { e.printStackTrace(System.err); } } }