Java tutorial
import java.awt.Image; import java.io.IOException; import javax.swing.ImageIcon; public class Main { static boolean isImage(String image_path) { Image image = new ImageIcon(image_path).getImage(); if (image.getWidth(null) == -1) { return false; } else { return true; } } public static void main(String[] args) throws IOException { System.out.println(isImage("/Users/image.jpg")); } }