Class ImageUtils


  • public final class ImageUtils
    extends Object
    Image manipulation utilities.
    Author:
    Adrian Herscu
    • Method Detail

      • reduce

        public static BufferedImage reduce​(BufferedImage inputImage,
                                           IndexColorModel indexColorModel)
        Reduces the color palette of specified image.
        Parameters:
        inputImage - the image to reduce
        indexColorModel - the color model to apply
        Returns:
        the reduced image
      • scale

        public static BufferedImage scale​(BufferedImage inputImage,
                                          double widthScale,
                                          double heightScale)
        Scales a specified image using dedicated library.

        Good quality when scaling down.

        Parameters:
        inputImage - the image to scale
        widthScale - the width scale factor
        heightScale - the height scale factor
        Returns:
        the scaled image
      • areaOf

        public static double areaOf​(BufferedImage image)
        Parameters:
        image - the image
        Returns:
        the area of image
      • adapt

        public static org.apache.commons.lang3.tuple.Pair<BufferedImage,​BufferedImage> adapt​(org.apache.commons.lang3.tuple.Pair<BufferedImage,​BufferedImage> pair)
        Makes two images same size by scaling down the image with bigger area.
        Parameters:
        pair - images to adapt
        Returns:
        adapted images