Class ImageWriterUtil


  • public final class ImageWriterUtil
    extends java.lang.Object
    Convenience methods around ImageWriter for the most important tasks.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ImageWriterUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void saveAsFile​(java.awt.image.RenderedImage bitmap, int resolution, java.io.File outputFile, java.lang.String mime)
      Saves a RenderedImage as a file.
      static void saveAsPNG​(java.awt.image.RenderedImage bitmap, int resolution, java.io.File outputFile)
      Saves a RenderedImage as a PNG file.
      static void saveAsPNG​(java.awt.image.RenderedImage bitmap, java.io.File outputFile)
      Saves a RenderedImage as a PNG file with 96 dpi.
      • Methods inherited from class java.lang.Object

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

      • ImageWriterUtil

        private ImageWriterUtil()
    • Method Detail

      • saveAsPNG

        public static void saveAsPNG​(java.awt.image.RenderedImage bitmap,
                                     java.io.File outputFile)
                              throws java.io.IOException
        Saves a RenderedImage as a PNG file with 96 dpi.
        Parameters:
        bitmap - the bitmap to encode
        outputFile - the target file
        Throws:
        java.io.IOException - in case of an I/O problem
      • saveAsPNG

        public static void saveAsPNG​(java.awt.image.RenderedImage bitmap,
                                     int resolution,
                                     java.io.File outputFile)
                              throws java.io.IOException
        Saves a RenderedImage as a PNG file.
        Parameters:
        bitmap - the bitmap to encode
        resolution - the bitmap resolution
        outputFile - the target file
        Throws:
        java.io.IOException - in case of an I/O problem
      • saveAsFile

        public static void saveAsFile​(java.awt.image.RenderedImage bitmap,
                                      int resolution,
                                      java.io.File outputFile,
                                      java.lang.String mime)
                               throws java.io.IOException
        Saves a RenderedImage as a file. The image format is given through the MIME type
        Parameters:
        bitmap - the bitmap to encode
        resolution - the bitmap resolution
        outputFile - the target file
        mime - the MIME type of the target file
        Throws:
        java.io.IOException - in case of an I/O problem