/*
 * @(#) ImageIOViewer.java 1.0 99/10/4
 * Copyright (c) 1999 Larry Rodrigues
 */
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.imageio.*;
 /** View an image
   * @version 1.0  10 April 1999
   * @author Lawrence Rodrigues
   */
public class ImageIOViewer extends JPEGViewer {
   ImagePanel viewer;

   public static BufferedImage readAsBufferedImage(String filename) {
      try {
       BufferedImage img = ImageIO.read(new File(filename));
       return img;
      }catch (Exception e) {
       e.printStackTrace();
       return null;
      }
   }
   public BufferedImage loadImage(String filename){
      return ImageIOViewer.readAsBufferedImage(filename);
   }
   public static void  main(String[] args){
      ImageIOViewer ip = new ImageIOViewer();
      if(args.length <1) {
         System.out.println("Enter a valid image file name");
         System.exit(0);
      }
      ip.loadAndDisplay(args[0]);
   }
}
