public final class ImageResizeUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int[] |
computeDimensions(int width,
int height,
int originalWidth,
int originalHeight)
Compute target width and height based on requested width and height but
making sure the original dimensions of the image will be preserved.
|
static BufferedImage |
resizeImage(BufferedImage originalImage,
int width,
int height,
boolean preserveDimensions)
Resize an image with default quality settings.
|
static BufferedImage |
resizeImageWithHint(BufferedImage originalImage,
int width,
int height,
boolean preserveDimensions)
Resize an image with high quality settings.
|
public static BufferedImage resizeImage(BufferedImage originalImage, int width, int height, boolean preserveDimensions)
originalImage
- The image to resize.width
- The target width.height
- The target height.preserveDimensions
- Flag to know if we should preserve original image dimensions.public static BufferedImage resizeImageWithHint(BufferedImage originalImage, int width, int height, boolean preserveDimensions)
Resize an image with high quality settings.
originalImage
- The image to resize.width
- The target width.height
- The target height.preserveDimensions
- Flag to know if we should preserve original image dimensions.public static int[] computeDimensions(int width, int height, int originalWidth, int originalHeight)
width
- The ideal (and max) target width.height
- The ideal (and max) target height.originalWidth
- The original width.originalHeight
- The original height.Copyright © 2017. All rights reserved.