code: public static void writeImage(final BufferedImage im, final String formatName, final File output)
              throws IOException {
          if (!ImageIO.write(im, formatName, output)) {
              throw new RuntimeException("Image format not supported: " + formatName);
          }
      }
docs: Equivalent to {@link ImageIO#write}, but handle errors.
  
  @param im a <code>RenderedImage</code> to be written.
  @param formatName a <code>String</code> containing the informal name of the format.
  @param output a <code>File</code> to be written to.
  @throws IOException if an error occurs during writing.