public Picture(File file){
  try {
    image=ImageIO.read(file);
  }
 catch (  IOException e) {
    e.printStackTrace();
    throw new RuntimeException("Could not open file: " + file);
  }
  if (image == null) {
    throw new RuntimeException("Invalid image file: " + file);
  }
  width=image.getWidth(null);
  height=image.getHeight(null);
  filename=file.getName();
}

public Picture ( File file ) { try { image = ImageIO . read ( file ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( "Could not open file: " + file ) ; } if ( image == null ) { throw new RuntimeException ( "Invalid image file: " + file ) ; } width = image . getWidth ( null ) ; height = image . getHeight ( null ) ; filename = file . getName ( ) ; }
initializes a picture by reading in a . png , . gif , or . jpg from a file .
