code: public static boolean write(RenderedImage im, String formatName, File output) throws IOException {
  		if (output == null) {
  			throw new IllegalArgumentException("output == null!");
  		}
  		ImageOutputStream stream = null;
  		try {
  			output.delete();
  			stream = createImageOutputStream(output);
  		} catch (IOException e) {
  			throw new IIOException("Can't create output stream!", e);
  		}
  
  		boolean val;
  		try {
  			val = write(im, formatName, stream);
  		} finally {
  			stream.close();
  		}
  		return val;
  	}
docs: Writes an image using an arbitrary <code>ImageWriter</code> that supports the given format to a
  <code>File</code>. If there is already a <code>File</code> present, its contents are discarded.
  
  @param im
  a <code>RenderedImage</code> to be written.
  @param formatName
  a <code>String</code> containg the informal name of the format.
  @param output
  a <code>File</code> to be written to.
  
  @return <code>false</code> if no appropriate writer is found.
  
  @exception IllegalArgumentException
  if any parameter is <code>null</code>.
  @exception IOException
  if an error occurs during writing.