Package com.tagtraum.core.image
Class ImageScaler
- java.lang.Object
-
- com.tagtraum.core.image.ImageScaler
-
public final class ImageScaler extends Object
Allows to scale images efficiently and with high quality.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferedImage
scale(BufferedImage sourceImage, int targetWidth, int targetHeight, Object hint, boolean progressiveBilinear)
Convenience method that returns a scaled instance of the provided BufferedImage.static BufferedImage
scale(Image sourceImage, int targetWidth, int targetHeight)
Convenience method that returns a scaled instance of the provided image.
-
-
-
Method Detail
-
scale
public static BufferedImage scale(Image sourceImage, int targetWidth, int targetHeight)
Convenience method that returns a scaled instance of the provided image. Uses a multi-step approach for best results.- Parameters:
sourceImage
- the original image to be scaledtargetWidth
- the desired width of the scaled instance, in pixelstargetHeight
- the desired height of the scaled instance, in pixels- Returns:
- a scaled version of the original image
-
scale
public static BufferedImage scale(BufferedImage sourceImage, int targetWidth, int targetHeight, Object hint, boolean progressiveBilinear)
Convenience method that returns a scaled instance of the provided BufferedImage.- Parameters:
sourceImage
- the original image to be scaledtargetWidth
- the desired width of the scaled instance, in pixelstargetHeight
- the desired height of the scaled instance, in pixelshint
- one of the rendering hints that corresponds to RenderingHints.KEY_INTERPOLATION (e.g. RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR, RenderingHints.VALUE_INTERPOLATION_BILINEAR, RenderingHints.VALUE_INTERPOLATION_BICUBIC)progressiveBilinear
- if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in down-scaling cases, where targetWidth or targetHeight is smaller than the original dimensions)- Returns:
- a scaled version of the original BufferedImage
-
-