Java ByteBuffer Size FindResolution(BufferedImage img, double print_width, double print_height)

Here you can find the source of FindResolution(BufferedImage img, double print_width, double print_height)

Description

Find Resolution

License

Apache License

Declaration

public static int FindResolution(BufferedImage img, double print_width, double print_height) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.image.BufferedImage;

public class Main {
    public static int FindResolution(BufferedImage img, double print_width, double print_height) {
        int img_width = img.getWidth();
        int img_height = img.getHeight();
        System.out.println("Buffered Image Width: " + img_width + " Image Ht: " + img_height);
        int ppi1 = (int) ((double) img_width / (double) print_width);
        int ppi2 = (int) ((double) img_height / (double) print_height);
        int ppi = Math.min(ppi1, ppi2);
        System.out.println(" PPi1 " + ppi1 + " PPi2 " + ppi2 + " PPi " + ppi);
        return (ppi);
    }// w  w  w  .ja v  a 2  s .  co m

    public static int FindResolution(int origImgWt, int origImgHt, double print_width, double print_height) {
        System.out.println("Original Image Width: " + origImgWt + " Ht: " + origImgHt);
        int ppi1 = (int) ((double) origImgWt / (double) print_width);
        int ppi2 = (int) ((double) origImgHt / (double) print_height);
        int ppi = Math.min(ppi1, ppi2);
        System.out.println(" PPi1 " + ppi1 + " PPi2 " + ppi2 + " PPi " + ppi);
        return (ppi);
    }
}

Related

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