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);
    
     
    • 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, com.idrsolutions.image.encoder.options.EncoderOptions outputOptions, File outputFile)
      Convert between any supported image file formats
      static void convert​(File inputFile, File outputFile)
      Convert between any supported image file formats
      static void convert​(File inputFile, File outputFile, com.idrsolutions.image.process.ImageProcessingOps conversions)
      Convert between any supported image file formats and process image
      static void convert​(InputStream inputFile, OutputStream outputFile, String format)  
      static com.idrsolutions.image.encoder.options.Metadata getImageInfo​(byte[] imageBytes)
      Returns Metadata object describing Image
      static com.idrsolutions.image.encoder.options.Metadata getImageInfo​(File imageFile)
      Returns Metadata object describing Image
      static com.idrsolutions.image.encoder.options.Metadata getImageInfo​(InputStream inputStream)
      Returns Metadata object describing Image
      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​(com.idrsolutions.image.process.ImageProcessingOps conversions, BufferedImage image)
      Returns BufferedImage with processing options applied
      static BufferedImage read​(byte[] data)
      Returns BufferedImage from InputStream if supported ImageType bytes
      static BufferedImage read​(byte[] data, HashMap<String,​String> map)
      Returns BufferedImage from the byte[] if supported ImageType
      static BufferedImage read​(File imageFile)
      Returns BufferedImage from the File object if supported ImageType
      static BufferedImage read​(File imageFile, HashMap<String,​String> map)
      Returns BufferedImage from the File object if supported ImageType
      static BufferedImage read​(InputStream is)
      Returns BufferedImage from InoutStream if supported ImageType stream
      static BufferedImage read​(InputStream is, HashMap<String,​String> map)
      Returns BufferedImage from InputStream if supported ImageType
      static void write​(BufferedImage image, com.idrsolutions.image.encoder.options.EncoderOptions options, File outputFile)
      This method compress the buffered image into given output format
      static void write​(BufferedImage image, com.idrsolutions.image.encoder.options.EncoderOptions options, OutputStream outputStream)
      This method compress the buffered image into given output format
      static void write​(BufferedImage image, com.idrsolutions.image.encoder.OutputFormat format, File outputFile)
      This method compress the buffered image into given output format
      static void write​(BufferedImage image, com.idrsolutions.image.encoder.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 writes out a BufferedImage to any supported ImageType
      static void write​(BufferedImage image, String formatName, OutputStream stream)
      This method writes out a BufferedImage to any supported ImageType
      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.
      • Methods inherited from class com.idrsolutions.image.JDeliImage

        optimiseImage
    • 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,
                                   com.idrsolutions.image.encoder.options.EncoderOptions outputOptions,
                                   File outputFile)
                            throws Exception
        Convert between any supported image file formats
        Parameters:
        inputFile -
        outputOptions -
        outputFile -
        Throws:
        Exception
      • convert

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

        public static BufferedImage process​(com.idrsolutions.image.process.ImageProcessingOps conversions,
                                            BufferedImage image)
        Returns BufferedImage with processing options applied
        Parameters:
        conversions -
        image -
        Returns:
        BufferedImage
      • getImageInfo

        public static com.idrsolutions.image.encoder.options.Metadata getImageInfo​(File imageFile)
                                                                            throws Exception
        Returns Metadata object describing Image
        Parameters:
        imageFile -
        Returns:
        Specific instance of Metadata (ie BMPMetadata)
        Throws:
        Exception
      • getImageInfo

        public static com.idrsolutions.image.encoder.options.Metadata getImageInfo​(byte[] imageBytes)
                                                                            throws Exception
        Returns Metadata object describing Image
        Parameters:
        imageBytes -
        Returns:
        Specific instance of Metadata (ie BMPMetadata)
        Throws:
        Exception
      • getImageInfo

        public static com.idrsolutions.image.encoder.options.Metadata getImageInfo​(InputStream inputStream)
                                                                            throws Exception
        Returns Metadata object describing Image
        Parameters:
        inputStream -
        Returns:
        Specific instance of Metadata (ie BMPMetadata)
        Throws:
        Exception
      • read

        public static BufferedImage read​(File imageFile)
                                  throws Exception
        Returns BufferedImage from the File object if supported ImageType
        Parameters:
        imageFile -
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(File imageFile,
                                         HashMap<String,​String> map)
                                  throws Exception
        Returns BufferedImage from the File object if supported ImageType
        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 from the byte[] if supported ImageType
        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 from InputStream if supported ImageType bytes
        Parameters:
        data - raw image bytes
        Returns:
        BufferedImage
        Throws:
        Exception
      • read

        public static BufferedImage read​(InputStream is)
                                  throws Exception
        Returns BufferedImage from InoutStream if supported ImageType stream
        Parameters:
        is - input stream to read from
        Returns:
        BufferedImage
        Throws:
        Exception
      • write

        public static void write​(BufferedImage image,
                                 com.idrsolutions.image.encoder.options.EncoderOptions options,
                                 File outputFile)
                          throws Exception
        This method compress the buffered image into given output format
        Parameters:
        image - bufferedImage
        options - WriterOptions
        outputFile - output file
        Throws:
        Exception
        See Also:
        OutputFormat
      • write

        public static void write​(BufferedImage image,
                                 com.idrsolutions.image.encoder.OutputFormat format,
                                 File outputFile)
                          throws Exception
        This method compress the buffered image into given output format
        Parameters:
        image - bufferedImage
        format - output format
        outputFile - output file
        Throws:
        Exception
        See Also:
        OutputFormat
      • write

        public static void write​(BufferedImage image,
                                 String formatName,
                                 File outputFile)
                          throws Exception
        This method writes out a BufferedImage to any supported ImageType
        Parameters:
        image - bufferedImage
        formatName - output format name
        outputFile - output file
        Throws:
        Exception
        See Also:
        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 writes out a BufferedImage to any supported ImageType
        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,
                                 com.idrsolutions.image.encoder.options.EncoderOptions options,
                                 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
        options - WriterOptions
        outputStream - outputStream
        Throws:
        Exception
        See Also:
        OutputFormat
      • write

        public static void write​(BufferedImage image,
                                 com.idrsolutions.image.encoder.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:
        OutputFormat