List of utility methods to do Image File Check
boolean | isImage(File imageFile) is Image if (!imageFile.exists()) { return false; Image img = null; try { img = ImageIO.read(imageFile); if (img == null || img.getWidth(null) <= 0 || img.getHeight(null) <= 0) { return false; ... |
boolean | isImage(File img) is Image try { return isImage(ImageIO.read(img)); } catch (IOException e) { return false; |
boolean | isImage(File imgFile) is Image try { BufferedImage image = ImageIO.read(imgFile); return image != null; } catch (IOException e) { e.printStackTrace(); return false; |
boolean | isImage(InputStream is) is Image boolean ret = false; try { BufferedImage bufreader = ImageIO.read(is); int width = bufreader.getWidth(); int height = bufreader.getHeight(); if (width == 0 || height == 0) { ret = false; } else { ... |