tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Java > Image IO > How to get image writers by format name

How to get image writers by format name 

Java Image IO provides pluggable architecture for accessing images transparently. It is simple, flexible and allows us to plugin various image readers and writers with ease. The following example shows getting the registered image writers for given image format name.

File Name  :  
com/bethecoder/tutorials/imageio/GetImageWritersByFormatNameTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.imageio;

import java.io.IOException;
import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;

public class GetImageWritersByFormatNameTest {

  /**
   @param args
   @throws IOException 
   */
  public static void main(String[] argsthrows IOException {

    Iterator<ImageWriter> imgWriters = ImageIO.getImageWritersByFormatName("bmp");
    ImageWriter writer = null;
    
    while (imgWriters.hasNext()) {
      writer = imgWriters.next();

      System.out.println("Writer class : " + writer.getClass());
      System.out.println("Provider : " + writer.getOriginatingProvider());
    }
  }

}
   

It gives the following output,
Writer class : class com.sun.imageio.plugins.bmp.BMPImageWriter
Provider : [email protected]





                    Print

   



Books Recommendation

Your Ad Here
bl  br