Java ByteBuffer Size findNewHeight(BufferedImage origImage, double newWidth)

Here you can find the source of findNewHeight(BufferedImage origImage, double newWidth)

Description

find New Height

License

Open Source License

Declaration

private static int findNewHeight(BufferedImage origImage, double newWidth) 

Method Source Code


//package com.java2s;
/*//from  www. jav  a 2s  .c o  m
 * Copyright 2000-2013 Enonic AS
 * http://www.enonic.com/license
 */

import java.awt.image.BufferedImage;

public class Main {
    private static int findNewHeight(BufferedImage origImage, double newWidth) {
        final double ratio = (double) newWidth / (double) origImage.getWidth();
        return (int) Math.max(1.0, Math.round(ratio * origImage.getHeight()));
    }
}

Related

  1. depthToGrayBufferedImage(int[] depth, int width, int height)
  2. doThumb(BufferedImage from, int width, int height)
  3. enhance(int size, ByteBuffer bbuf)
  4. ensureBufferCapacity(final int width, final int height, BufferedImage img)
  5. erodeImage(final BufferedImage img, int structElementWidth, int structElementHeight, final int rgbForegroundColor, final int rgbBackgroundColor)
  6. FindResolution(BufferedImage img, double print_width, double print_height)
  7. fitToSize(BufferedImage source, int targetWidth, int targetHeight)
  8. generateScaledImage(final BufferedImage bufImg, @SuppressWarnings("unused") final Object hintsArg, final int size)
  9. makeBrighterRectangleOnImage(BufferedImage image, int leftPosition, int topPosition, int width, int height, double scaleFactor, Color borderColor, Stroke borderStroke)