Class JDeli

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.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 Details

    • JDeli

      public JDeli()
  • Method Details

    • convert

      public static void convert(File inputFile, File outputFile) throws Exception
      Convert between any supported image file formats
      Parameters:
      inputFile - source file
      outputFile - destination for output
      Throws:
      Exception - if an error occurs in converting image
    • convert

      public static void convert(File inputFile, EncoderOptions outputOptions, File outputFile) throws Exception
      Convert between any supported image file formats
      Parameters:
      inputFile - source file
      outputOptions - set values to control output
      outputFile - destination for output
      Throws:
      Exception - if an error occurs in converting image
    • 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 - source file
      outputFile - destination for output
      conversions - image processing operations to perform
      Throws:
      Exception - if an error occurs in converting image
    • process

      public static BufferedImage process(com.idrsolutions.image.process.ImageProcessingOps conversions, BufferedImage image)
      Returns BufferedImage with processing options applied
      Parameters:
      conversions - Image processing operations to apply
      image - source image for processing
      Returns:
      BufferedImage
    • convert

      public static void convert(InputStream inputFile, OutputStream outputFile, String format) throws Exception
      Throws:
      Exception
    • convert

      public static byte[] convert(byte[] inputData, String format) throws Exception
      Throws:
      Exception
    • getImageInfo

      public static Metadata getImageInfo(File imageFile) throws Exception
      Returns Metadata object describing Image
      Parameters:
      imageFile - source image path
      Returns:
      Specific instance of Metadata (ie BMPMetadata)
      Throws:
      Exception - if an error occurs in reading image
    • getImageInfo

      public static Metadata getImageInfo(byte[] imageBytes) throws Exception
      Returns Metadata object describing Image
      Parameters:
      imageBytes - source image data
      Returns:
      Specific instance of Metadata (ie BMPMetadata)
      Throws:
      Exception - if an error occurs in reading image
    • getImageInfo

      public static Metadata getImageInfo(InputStream inputStream) throws Exception
      Returns Metadata object describing Image
      Parameters:
      inputStream - source for image data
      Returns:
      Specific instance of Metadata (ie BMPMetadata)
      Throws:
      Exception - if an error occurs in reading image
    • readEmbeddedThumbnail

      public static BufferedImage readEmbeddedThumbnail(byte[] imageBytes) throws Exception
      Returns an embedded Thumbnail if found in Image file (or null)
      Parameters:
      imageBytes - source image data
      Returns:
      BufferedImage or null if no embedded thumbnail present
      Throws:
      Exception - if an error occurs in reading image
    • readEmbeddedThumbnail

      public static BufferedImage readEmbeddedThumbnail(File imageFile) throws Exception
      Returns an embedded Thumbnail if found in Image file (or null)
      Parameters:
      imageFile - source image path
      Returns:
      BufferedImage or null if no embedded thumbnail present
      Throws:
      Exception - if an error occurs in reading image
    • readEmbeddedThumbnail

      public static BufferedImage readEmbeddedThumbnail(InputStream inputStream) throws Exception
      Returns an embedded Thumbnail if found in Image file (or null)
      Parameters:
      inputStream - source image path
      Returns:
      BufferedImage or null if no embedded thumbnail present
      Throws:
      Exception - if an error occurs in reading image
    • readDimension

      public static Rectangle readDimension(byte[] imageBytes) throws Exception
      Returns an Image dimensions
      Parameters:
      imageBytes - source image data
      Returns:
      Rectangle or null if not supported or unable to read
      Throws:
      Exception - if an error occurs in reading image
    • readDimension

      public static Rectangle readDimension(File imageFile) throws Exception
      Returns an Image dimensions
      Parameters:
      imageFile - source image path
      Returns:
      Rectangle or null if not supported or unable to read
      Throws:
      Exception - if an error occurs in reading image
    • readDimension

      public static Rectangle readDimension(InputStream inputStream) throws Exception
      Returns an Image dimensions
      Parameters:
      inputStream - source image path
      Returns:
      Rectangle or null if not supported or unable to read
      Throws:
      Exception - if an error occurs in reading image
    • read

      public static BufferedImage read(File imageFile) throws Exception
      Returns BufferedImage from the File object if supported ImageType
      Parameters:
      imageFile - path for image file
      Returns:
      BufferedImage
      Throws:
      Exception - if an error occurs in reading image
    • read

      public static BufferedImage read(File imageFile, HashMap<String,String> map) throws Exception
      Returns BufferedImage from the File object if supported ImageType
      Parameters:
      imageFile - path for image file
      map - map to put custom parameters
      Returns:
      BufferedImage
      Throws:
      Exception - if an error occurs in reading image
    • 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 - if an error occurs in reading image
    • 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 - if an error occurs in reading image
    • read

      public static BufferedImage read(InputStream is, HashMap<String,String> map) throws Exception
      Returns BufferedImage from InputStream if supported ImageType
      Parameters:
      is - input stream to read from
      map - configuration options to apply
      Returns:
      BufferedImage
      Throws:
      Exception - if an error occurs in reading image
    • 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 - if an error occurs in reading image
    • write

      public static void write(BufferedImage image, 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 - if an error occurs in reading image
      See Also:
    • write

      public static void write(BufferedImage image, 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 - if an error occurs in reading image
      See Also:
    • 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 - if an error occurs in writing image
      See Also:
    • isImageSupportedForOutput

      public static boolean isImageSupportedForOutput(String formatName)
      return whether the image format name is supported for writing
      Parameters:
      formatName - three letter file format
      Returns:
      value to show if image can be output by jdeli
    • isImageSupportedForInput

      public static boolean isImageSupportedForInput(String formatName)
      return whether the image format name is supported for reading from
      Parameters:
      formatName - three letter file format
      Returns:
      value to show if image can be read by jdeli
    • 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 - if an error occurs in writing image
    • write

      public static void write(BufferedImage image, 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 - if an error occurs in writing image
      See Also:
    • write

      public static void write(BufferedImage image, 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 - if an error occurs in writing image
      See Also: