Here you can find the source of getHeight(final File image)
Parameter | Description |
---|---|
image | image file. |
Parameter | Description |
---|---|
IOException | Failed to read the image. |
public static int getHeight(final File image) throws IOException
//package com.java2s; /*//from w w w .ja va 2 s. c o m * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * If applicable, add the following below this MPL 2.0 HEADER, replacing * the fields enclosed by brackets "[]" replaced with your own identifying * information: * Portions Copyright [yyyy] [name of copyright owner] * * Copyright 2013-2014 ForgeRock AS * */ import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class Main { /** * Return image height in pixels. * * @param image image file. * @throws IOException Failed to read the image. * @return Image height in pixels. */ public static int getHeight(final File image) throws IOException { BufferedImage bufferedImage = ImageIO.read(image); return bufferedImage.getHeight(); } }