Java BufferedImage Height Get getHeight(File file)

Here you can find the source of getHeight(File file)

Description

get Height

License

Open Source License

Declaration

public static int getHeight(File file) 

Method Source Code


//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;
    }
}

Related

  1. getHeight(BufferedImage image)
  2. getHeight(BufferedImage image, int x, int y)