Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Example Java Swing Graphics2D Show Image Reader and Image Writer by image format

Related Tutorials


 
 

Share on Google+Share on Google+

Show Image Reader and Image Writer by image format

Advertisement
This section illustrates you how to display the Image Reader and Image Writer by the image format.

Show Image Reader and Image Writer by image format

     

This section illustrates you how to display the Image Reader and Image Writer by the image format. 

To show the image reader and image writer, we have used ImageIO class of the package javax.imageio.*. The ImageIO class provides methods for locating ImageReaders and ImageWriters.

The method getReaderFormatNames() of class ImageIO returns an array of strings consisting of all the image format names which the current set of registered readers understands. The method getWriterFormatNames() returns an array of strings consisting of all the image format names which the current set of registered writers understands.

Here is the code of ShowImageIOReaderAndWriter.java

import javax.imageio.*;

public class ShowImageIOReaderAndWriter {
  static public void main(String args[]) throws Exception{
  String reader[] = ImageIO.getReaderFormatNames();
  for (int k = 0; k < reader.length; k++) {
  System.out.println("reader " + reader[k]);
  }
  reader = ImageIO.getWriterFormatNames();
  for (int k = 0; k < reader.length; k++) {
  System.out.println("writer " + reader[k]);
  }
  }
}

Output will be displayed on the console:

Download source code

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 15, 2008

Related Tutorials

Discuss: Show Image Reader and Image Writer by image format  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com