ImageInputStream iis = ImageIO.createImageInputStream(new File(
"E:/1.jpg"));
Iterator iter = ImageIO.getImageReaders(iis);
if (!iter.hasNext()) {
System.out.println("null");
}else{
ImageReader reader = (ImageReader) iter.next();
System.out.println(reader.getFormatName());
}