Here you can find the source of getHeight(File file)
public static int getHeight(File file)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Main { public static int getHeight(File file) { BufferedImage bufImg = getBufferedImage(file); if (bufImg != null) { return bufImg.getHeight(); }/*from w w w .java 2 s .co m*/ return 0; } public static BufferedImage getBufferedImage(File file) { try { return ImageIO.read(file); } catch (IOException e) { e.printStackTrace(); } return null; } }