Java BufferedImage Size Get getSizeByHeight(int height, Image image)

Here you can find the source of getSizeByHeight(int height, Image image)

Description

get Size By Height

License

Open Source License

Declaration

public static int[] getSizeByHeight(int height, Image image) 

Method Source Code


//package com.java2s;
import java.awt.Image;

public class Main {
    public static int[] getSizeByHeight(int height, Image image) {
        int targetWidth = image.getWidth(null);
        int targetHeight = image.getHeight(null);
        long width = Math.round((targetWidth * height) / (targetHeight * 1.00f));
        return new int[] { Integer.parseInt(String.valueOf(width)), height };
    }/* w  ww  .  ja va  2s  .  com*/
}

Related

  1. getDimension(File f)
  2. getDimension(final Image anImage, final ImageObserver obs)
  3. getDimensions(byte[] image)
  4. getSize(BufferedImage image)
  5. getSize(int width, int height, Image image)
  6. getSizedImage(final URL url, final Dimension size)