Class ImageHelper


  • @Beta
    public final class ImageHelper
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage createImage​(int width, int height, boolean hasAlpha)  
      static java.awt.image.BufferedImage createImage​(java.awt.image.BufferedImage src, boolean hasAlpha)  
      static java.lang.String createImagePlaceholder​(int width, int height)  
      static java.awt.image.BufferedImage getScaledInstance​(java.awt.image.BufferedImage img, int targetWidth, int targetHeight)  
      static javax.imageio.ImageWriter getWriterByFormat​(java.lang.String format)  
      static java.awt.image.BufferedImage removeAlphaChannel​(java.awt.image.BufferedImage img, int color)  
      static java.awt.image.BufferedImage scaleSquare​(java.awt.image.BufferedImage source, int size)  
      static java.awt.image.BufferedImage scaleSquare​(java.awt.image.BufferedImage source, int size, double xOffset, double yOffset)  
      static boolean supportsAlphaChannel​(java.lang.String format)  
      static java.awt.image.BufferedImage toBufferedImage​(java.io.InputStream inputStream)  
      static com.google.common.io.ByteSource toByteSource​(java.awt.image.BufferedImage image, java.lang.String format)  
      static byte[] writeImage​(java.awt.image.BufferedImage image, java.lang.String format, int quality)  
      static void writeImage​(java.io.OutputStream out, java.awt.image.BufferedImage image, java.lang.String format, int quality)  
      • Methods inherited from class java.lang.Object

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

      • createImagePlaceholder

        public static java.lang.String createImagePlaceholder​(int width,
                                                              int height)
      • toBufferedImage

        public static java.awt.image.BufferedImage toBufferedImage​(java.io.InputStream inputStream)
      • toByteSource

        public static com.google.common.io.ByteSource toByteSource​(java.awt.image.BufferedImage image,
                                                                   java.lang.String format)
      • getWriterByFormat

        public static javax.imageio.ImageWriter getWriterByFormat​(java.lang.String format)
      • writeImage

        public static byte[] writeImage​(java.awt.image.BufferedImage image,
                                        java.lang.String format,
                                        int quality)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeImage

        public static void writeImage​(java.io.OutputStream out,
                                      java.awt.image.BufferedImage image,
                                      java.lang.String format,
                                      int quality)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • createImage

        public static java.awt.image.BufferedImage createImage​(java.awt.image.BufferedImage src,
                                                               boolean hasAlpha)
      • createImage

        public static java.awt.image.BufferedImage createImage​(int width,
                                                               int height,
                                                               boolean hasAlpha)
      • getScaledInstance

        public static java.awt.image.BufferedImage getScaledInstance​(java.awt.image.BufferedImage img,
                                                                     int targetWidth,
                                                                     int targetHeight)
      • removeAlphaChannel

        public static java.awt.image.BufferedImage removeAlphaChannel​(java.awt.image.BufferedImage img,
                                                                      int color)
      • supportsAlphaChannel

        public static boolean supportsAlphaChannel​(java.lang.String format)
      • scaleSquare

        public static java.awt.image.BufferedImage scaleSquare​(java.awt.image.BufferedImage source,
                                                               int size)
      • scaleSquare

        public static java.awt.image.BufferedImage scaleSquare​(java.awt.image.BufferedImage source,
                                                               int size,
                                                               double xOffset,
                                                               double yOffset)