Here you can find the source of isImage(File imageFile)
public static boolean isImage(File imageFile)
//package com.java2s; //License from project: Open Source License import javax.imageio.ImageIO; import java.awt.*; import java.io.File; public class Main { public static boolean isImage(File imageFile) { if (!imageFile.exists()) { return false; }// w w w. ja v a 2 s.co m try { Image img = ImageIO.read(imageFile); if (img == null || img.getWidth(null) <= 0 || img.getHeight(null) <= 0) { return false; } return true; } catch (Exception e) { return false; } } }