Class JDeli


  • public class JDeli
    extends com.idrsolutions.image.JDeliImage
    Class reads and writes image files.

    Example to read an image, where:

    • imageFile is of type File
    
     JDeli.read(imageFile);
     

    Example to write an image, where:

    • image is of type BufferedImage
    • outputFormat is of type OutputFormat
    • outputFile is of type File
    
     JDeli.write(image, OutputFormat.PNG, outputFile);
     or
     JDeli.write(image, "png", outputFile);
     or
     JDeli.write(image, "png", outputStream);
    
     
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JDeli.OutputFormat
      Available image compression output formats
    • Constructor Summary

      Constructors 
      Constructor Description
      JDeli()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] convert​(byte[] inputData, String format)  
      static void convert​(File inputFile, File outputFile)
      Convert between any supported image file formats
      static void convert​(File inputFile, File outputFile, ImageProcessingOperations conversions)
      Convert between any supported image file formats and process image
      static void convert​(InputStream inputFile, OutputStream outputFile, String format)  
      static boolean isImageSupportedForInput​(String formatName)
      return whether the image format name is supported for reading from
      static boolean isImageSupportedForOutput​(String formatName)
      return whether the image format name is supported for writing
      static void main​(String[] args)  
      static BufferedImage process​(ImageProcessingOperations conversions, BufferedImage image)
      Returns BufferedImage with processing options applied
      static BufferedImage read​(byte[] data)
      Returns BufferedImage as the result of decoding a supplied image file bytes
      This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
      static BufferedImage read​(byte[] data, HashMap<String,​String> map)
      Returns BufferedImage as the result of decoding a supplied imagefile
      This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
      static BufferedImage read​(File imageFile)
      Returns BufferedImage as the result of decoding a supplied imagefile
      This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
      static BufferedImage read​(File imageFile, HashMap<String,​String> map)
      Returns BufferedImage as the result of decoding a supplied imagefile
      This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
      static BufferedImage read​(InputStream is)
      Returns BufferedImage as the result of decoding a supplied image input stream
      This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
      static BufferedImage read​(InputStream is, HashMap<String,​String> map)
      Returns BufferedImage as the result of decoding a supplied image input stream
      This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
      static void write​(BufferedImage image, JDeli.OutputFormat format, File outputFile)
      This method compress the buffered image into given output format
      static void write​(BufferedImage image, JDeli.OutputFormat format, OutputStream outputStream)
      This method compress the buffered image into given output format
      static void write​(BufferedImage image, String formatName, File outputFile)
      This method compress the buffered image into given output format Available format names are "jpg", "png", "tiff", "bmp", "pdf"
      Please note : we will be adding more formats in future
      static void write​(BufferedImage image, String formatName, OutputStream stream)
      This method compress the buffered image into given output format Available format names are "jpg", "jp2", "jpx", "png", "tiff", "bmp"
      Please note : we will be adding more formats in future
    • Constructor Detail

      • JDeli

        public JDeli()
    • Method Detail

      • convert

        public static void convert​(File inputFile,
                                   File outputFile)
                            throws Exception
        Convert between any supported image file formats
        Parameters:
        inputFile -
        outputFile -
        Throws:
        Exception
      • convert

        public static void convert​(File inputFile,
                                   File outputFile,
                                   ImageProcessingOperations conversions)
                            throws Exception
        Convert between any supported image file formats and process image
        Parameters:
        inputFile -
        outputFile -
        conversions -
        Throws:
        Exception
      • read

        public static BufferedImage read​(File imageFile)
                                  throws Exception
        Returns BufferedImage as the result of decoding a supplied imagefile
        This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
        Parameters:
        imageFile -
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(File imageFile,
                                         HashMap<String,​String> map)
                                  throws Exception
        Returns BufferedImage as the result of decoding a supplied imagefile
        This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
        Parameters:
        imageFile -
        map - map to put custom parameters
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(byte[] data,
                                         HashMap<String,​String> map)
                                  throws Exception
        Returns BufferedImage as the result of decoding a supplied imagefile
        This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
        Parameters:
        data - compressed image data as bytes
        map - map to put custom parameters
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(byte[] data)
                                  throws Exception
        Returns BufferedImage as the result of decoding a supplied image file bytes
        This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
        Parameters:
        data - raw image bytes
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(InputStream is,
                                         HashMap<String,​String> map)
                                  throws Exception
        Returns BufferedImage as the result of decoding a supplied image input stream
        This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
        Parameters:
        is - input stream to read from
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(InputStream is)
                                  throws Exception
        Returns BufferedImage as the result of decoding a supplied image input stream
        This method can open files with extension of jpg, jpeg, jp2, jpx, dcm, png, apng, tiff, gif, webp, sgi, rgb, psd and bmp.
        Parameters:
        is - input stream to read from
        Returns:
        BufferedImage
        Throws:
        Exception
      • write

        public static void write​(BufferedImage image,
                                 String formatName,
                                 File outputFile)
                          throws Exception
        This method compress the buffered image into given output format Available format names are "jpg", "png", "tiff", "bmp", "pdf"
        Please note : we will be adding more formats in future
        Parameters:
        image - bufferedImage
        formatName - output format name
        outputFile - output file
        Throws:
        Exception
        See Also:
        JDeli.OutputFormat
      • isImageSupportedForOutput

        public static boolean isImageSupportedForOutput​(String formatName)
        return whether the image format name is supported for writing
        Parameters:
        formatName -
        Returns:
      • isImageSupportedForInput

        public static boolean isImageSupportedForInput​(String formatName)
        return whether the image format name is supported for reading from
        Parameters:
        formatName -
        Returns:
      • write

        public static void write​(BufferedImage image,
                                 String formatName,
                                 OutputStream stream)
                          throws Exception
        This method compress the buffered image into given output format Available format names are "jpg", "jp2", "jpx", "png", "tiff", "bmp"
        Please note : we will be adding more formats in future

        This method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream.

        Parameters:
        image - bufferedImage
        formatName - output format name
        stream - output stream
        Throws:
        Exception
      • write

        public static void write​(BufferedImage image,
                                 JDeli.OutputFormat format,
                                 OutputStream outputStream)
                          throws Exception
        This method compress the buffered image into given output format

        This method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream.

        Parameters:
        image - bufferedImage
        format - output format
        outputStream - outputStream
        Throws:
        Exception
        See Also:
        JDeli.OutputFormat