Here you can find the source of isImage(File imgFile)
public static boolean isImage(File imgFile)
//package com.java2s; //License from project: Open Source License import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.*; public class Main { public static boolean isImage(File imgFile) { try {// w w w . j a v a 2 s . c o m BufferedImage image = ImageIO.read(imgFile); return image != null; } catch (IOException e) { e.printStackTrace(); return false; } } }