question: public static void writeAsPNG ( Drawable drawable , int w , int h , File file ) throws FileNotFoundException , IOException { BufferedImage image = new BufferedImage ( w , h , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D g2 = image . createGraphics ( ) ; drawable . draw ( g2 , new Rectangle ( w , h ) ) ; OutputStream out = new BufferedOutputStream ( new FileOutputStream ( file ) ) ; try { ImageIO . write ( image , "png" , out ) ; } finally { out . close ( ) ; } }
target:  Writes the current content to the specified file in PNG format.