Here you can find the source of loadImage(File file)
public static BufferedImage loadImage(File file)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Main { public static BufferedImage loadImage(File file) { BufferedImage bi = null;/*from ww w . ja v a 2 s . co m*/ try { bi = ImageIO.read(file); } catch (IOException e) { e.printStackTrace(); } return bi; } }