Class ImageUtils


  • public final class ImageUtils
    extends java.lang.Object
    Image utilities
    Since:
    18592
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ImageUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void applyExif​(ImageMetadata image, java.io.InputStream inputStream)
      Apply exif information from an InputStream
      static java.awt.image.BufferedImage applyExifRotation​(java.awt.image.BufferedImage img, java.lang.Integer exifOrientation)
      Rotate an image, if needed
      private static com.drew.metadata.Metadata getMetadata​(java.net.URI uri, java.io.InputStream inputStream)  
      private static <T> void ifNotNull​(T value, java.util.function.Consumer<T> setter)  
      static javax.imageio.ImageReadParam withSubsampling​(javax.imageio.ImageReader reader, java.awt.Dimension target)
      Common subsampling method
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • applyExifRotation

        public static java.awt.image.BufferedImage applyExifRotation​(java.awt.image.BufferedImage img,
                                                                     java.lang.Integer exifOrientation)
        Rotate an image, if needed
        Parameters:
        img - The image to rotate
        exifOrientation - The exif orientation
        Returns:
        The rotated image or the original
      • withSubsampling

        public static javax.imageio.ImageReadParam withSubsampling​(javax.imageio.ImageReader reader,
                                                                   java.awt.Dimension target)
        Common subsampling method
        Parameters:
        reader - The image reader
        target - The target area
        Returns:
        The sampling parameters
      • applyExif

        public static void applyExif​(ImageMetadata image,
                                     java.io.InputStream inputStream)
        Apply exif information from an InputStream
        Parameters:
        image - The image to apply information to
        inputStream - The input stream to read
      • getMetadata

        private static com.drew.metadata.Metadata getMetadata​(java.net.URI uri,
                                                              java.io.InputStream inputStream)
      • ifNotNull

        private static <T> void ifNotNull​(T value,
                                          java.util.function.Consumer<T> setter)