Package io.jans.util.image
Class ImageTransformationUtility
java.lang.Object
io.jans.util.image.ImageTransformationUtility
Utility to do high quality image resize
- Author:
- Yuriy Movchan Date: 11.03.2010
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagescaleImage(BufferedImage img, int maxWidth, int maxHeight) static BufferedImagescaleImage(BufferedImage img, int maxWidth, int maxHeight, Object hint, boolean higherQuality) Convenience method that returns a scaled instance of the providedBufferedImage.
-
Method Details
-
scaleImage
- Parameters:
img- the original image to be scaledmaxWidth- the desired width of the scaled instance, in pixelsmaxHeight- the desired height of the scaled instance, in pixels- Returns:
- a scaled version of the original
BufferedImage
-
scaleImage
public static BufferedImage scaleImage(BufferedImage img, int maxWidth, int maxHeight, Object hint, boolean higherQuality) Convenience method that returns a scaled instance of the providedBufferedImage.- Parameters:
img- the original image to be scaledmaxWidth- the desired width of the scaled instance, in pixelsmaxHeight- the desired height of the scaled instance, in pixelshint- one of the rendering hints that corresponds toRenderingHints.KEY_INTERPOLATION(e.g.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,RenderingHints.VALUE_INTERPOLATION_BILINEAR,RenderingHints.VALUE_INTERPOLATION_BICUBIC)higherQuality- if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, wheretargetWidthortargetHeightis smaller than the original dimensions, and generally only when theBILINEARhint is specified)- Returns:
- a scaled version of the original
BufferedImage
-