title: Java - Convert File[] item to BufferedImage
body: <p>I have an array of 300 image filenames and wish to convert each filename into a new BufferedImage.</p>
  
  <p>Array of 300 image names is created thus:</p>
  
  <pre><code>//Default image directory (to convert to greyscale).
  static File dir = new File("images");
  //Array of original image filenames.
  static File imgList[] = dir.listFiles();
  
  public static void processGreyscale(){
      if(dir.isDirectory()){
          for(File img : imgList){
              if(img.isFile()){
                  //functions are carried out here.
              }
              else{
                  //functions are carried out here.
              }
          }
      }
  }
  </code></pre>
  
  <p>Is there a way to convert all <code>imgList[x]</code> items to <code>BufferedImage</code> items using something along the lines of:</p>
  
  <pre><code>File file = new File(new BufferedImage(imgList[0-300]));
  
  try {
      image = ImageIO.read(file);
  } catch (IOException e) {
      ...
  }
  </code></pre>