Class ImportExportImage


  • public class ImportExportImage
    extends java.lang.Object
    Helper class to read content of an image into BufferedImage object & write BufferedImage into image file
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static in.itzmeanjan.filterit.ReturnVal exportImage​(java.awt.image.BufferedImage img, java.lang.String sink)
      Exports content of BufferedImage into a sink file
      static java.lang.String imageExtension​(java.lang.String fileName)
      Given an image file name, obtains extension of that image i.e.
      static java.awt.image.BufferedImage importImage​(java.lang.String src)
      Reads content of specified image file into a BufferedImage object
      static java.awt.image.BufferedImage prepareCanvas​(int width, int height, java.awt.Color color)
      Generates a RGB buffered image of specified size, with each pixel set to given color
      static java.awt.image.BufferedImage setCanvas​(java.awt.image.BufferedImage img, java.awt.Color color)
      Given a buffered image, we'll modify it by setting each pixel with provided color, could be helpful in setting background of image & then draw on it.
      • Methods inherited from class java.lang.Object

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

      • ImportExportImage

        public ImportExportImage()
    • Method Detail

      • importImage

        public static java.awt.image.BufferedImage importImage​(java.lang.String src)
        Reads content of specified image file into a BufferedImage object
      • exportImage

        public static in.itzmeanjan.filterit.ReturnVal exportImage​(java.awt.image.BufferedImage img,
                                                                   java.lang.String sink)
        Exports content of BufferedImage into a sink file
      • imageExtension

        public static java.lang.String imageExtension​(java.lang.String fileName)
        Given an image file name, obtains extension of that image i.e. jpg / png
      • setCanvas

        public static java.awt.image.BufferedImage setCanvas​(java.awt.image.BufferedImage img,
                                                             java.awt.Color color)
        Given a buffered image, we'll modify it by setting each pixel with provided color, could be helpful in setting background of image & then draw on it.
        Parameters:
        img - Image to be modified
        color - Color value to be set at each pixel location across image I
        Returns:
        Returns modified image buffer, in place editing performed
      • prepareCanvas

        public static java.awt.image.BufferedImage prepareCanvas​(int width,
                                                                 int height,
                                                                 java.awt.Color color)
        Generates a RGB buffered image of specified size, with each pixel set to given color
        Parameters:
        width - Width of image to be generated
        height - Height of image to be generated
        color - Color at each pixel on image
        Returns:
        Buffered RGB image with pixels set to specified color intensity value