Here you can find the source of getWriterByFormat(final String format)
public static ImageWriter getWriterByFormat(final String format)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import javax.imageio.ImageIO; import javax.imageio.ImageWriter; public class Main { public static ImageWriter getWriterByFormat(final String format) { final Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(format); if (iter.hasNext()) { return iter.next(); } else {/* w w w . j a va2 s. c o m*/ throw new IllegalArgumentException("Image format [" + format + "] is not supported"); } } }