Package com.idrsolutions.image
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);
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
convert
(byte[] inputData, com.idrsolutions.image.encoder.options.EncoderOptions options) Convert between any supported image file formats and process imagestatic byte[]
Convert between any supported image file formats and process imagestatic byte[]
convert
(byte[] inputData, String format, com.idrsolutions.image.process.ImageProcessingOps operations) Convert between any supported image file formats and process imagestatic void
convert
(File inputFile, com.idrsolutions.image.encoder.options.EncoderOptions outputOptions, File outputFile) Convert between any supported image file formatsstatic void
Convert between any supported image file formatsstatic void
convert
(File inputFile, File outputFile, com.idrsolutions.image.process.ImageProcessingOps operations) Convert between any supported image file formats and process imagestatic void
convert
(InputStream inputStream, com.idrsolutions.image.encoder.options.EncoderOptions outputOptions, OutputStream outputStream, String format) Convert between any supported image file formatsstatic void
convert
(InputStream inputStream, OutputStream outputStream, String format) Convert between any supported image file formats and process imagestatic void
convert
(InputStream inputStream, OutputStream outputStream, String format, com.idrsolutions.image.process.ImageProcessingOps operations) Convert between any supported image file formats and process imagestatic byte[]
filter
(byte[] raw_data, com.idrsolutions.image.filter.FilterOptions options) This method filters the data using the chosen algorithmstatic void
filter
(InputStream inputStream, com.idrsolutions.image.filter.FilterOptions options, OutputStream outputStream) This method filters the data using the chosen algorithmstatic com.idrsolutions.image.metadata.Metadata
getImageInfo
(byte[] imageBytes) Returns Metadata object describing Imagestatic com.idrsolutions.image.metadata.Metadata
getImageInfo
(File imageFile) Returns Metadata object describing Imagestatic com.idrsolutions.image.metadata.Metadata
getImageInfo
(InputStream inputStream) Returns Metadata object describing Imagestatic boolean
isImageSupportedForInput
(String formatName) return whether the image format name is supported for reading fromstatic boolean
isImageSupportedForOutput
(String formatName) return whether the image format name is supported for writingstatic BufferedImage
process
(com.idrsolutions.image.process.ImageProcessingOps operations, BufferedImage image) Returns BufferedImage with processing options appliedstatic BufferedImage
read
(byte[] data) Returns BufferedImage from InputStream if supported ImageType bytesstatic BufferedImage
Returns BufferedImage from the byte[] if supported ImageTypestatic BufferedImage
Returns BufferedImage from the File object if supported ImageTypestatic BufferedImage
Returns BufferedImage from the File object if supported ImageTypestatic BufferedImage
read
(InputStream is) Returns BufferedImage from InputStream if supported ImageType streamstatic BufferedImage
read
(InputStream is, HashMap<String, String> map) Returns BufferedImage from InputStream if supported ImageTypestatic Rectangle
readDimension
(byte[] imageBytes) Returns an Image dimensionsstatic Rectangle
readDimension
(File imageFile) Returns an Image dimensionsstatic Rectangle
readDimension
(InputStream inputStream) Returns an Image dimensionsstatic BufferedImage
readEmbeddedThumbnail
(byte[] imageBytes) Returns an embedded Thumbnail if found in Image file (or null)static BufferedImage
readEmbeddedThumbnail
(File imageFile) Returns an embedded Thumbnail if found in Image file (or null)static BufferedImage
readEmbeddedThumbnail
(InputStream inputStream) Returns an embedded Thumbnail if found in Image file (or null)static byte[]
write
(BufferedImage image, com.idrsolutions.image.encoder.options.EncoderOptions options) This method compress the buffered image into given output formatstatic void
write
(BufferedImage image, com.idrsolutions.image.encoder.options.EncoderOptions options, File outputFile) This method compress the buffered image into given output formatstatic void
write
(BufferedImage image, com.idrsolutions.image.encoder.options.EncoderOptions options, OutputStream outputStream) This method compress the buffered image into given output formatstatic void
write
(BufferedImage image, com.idrsolutions.image.encoder.OutputFormat format, File outputFile) This method compress the buffered image into given output formatstatic void
write
(BufferedImage image, com.idrsolutions.image.encoder.OutputFormat format, OutputStream outputStream) This method compress the buffered image into given output formatstatic byte[]
write
(BufferedImage image, String formatName)
This method writes out a BufferedImage to any supported ImageType to a byte[] arraystatic void
write
(BufferedImage image, String formatName, File outputFile) This method writes out a BufferedImage to any supported ImageTypestatic 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 Details
-
JDeli
public JDeli()
-
-
Method Details
-
convert
Convert between any supported image file formats- Parameters:
inputFile
- source fileoutputFile
- destination for output- Throws:
Exception
- if an error occurs in converting image
-
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
- source fileoutputOptions
- set values to control outputoutputFile
- destination for output- Throws:
Exception
- if an error occurs in converting image
-
convert
public static void convert(InputStream inputStream, com.idrsolutions.image.encoder.options.EncoderOptions outputOptions, OutputStream outputStream, String format) throws Exception Convert between any supported image file formats- Parameters:
inputStream
- source inputStreamoutputOptions
- set values to control outputoutputStream
- destination for outputformat
- image format- Throws:
Exception
- if an error occurs in converting image
-
convert
public static void convert(File inputFile, File outputFile, com.idrsolutions.image.process.ImageProcessingOps operations) throws Exception Convert between any supported image file formats and process image- Parameters:
inputFile
- source fileoutputFile
- destination for outputoperations
- image processing operations to perform- Throws:
Exception
- if an error occurs in converting image
-
process
public static BufferedImage process(com.idrsolutions.image.process.ImageProcessingOps operations, BufferedImage image) Returns BufferedImage with processing options applied- Parameters:
operations
- Image processing operations to applyimage
- source image for processing- Returns:
- BufferedImage
-
convert
public static void convert(InputStream inputStream, OutputStream outputStream, String format) throws Exception Convert between any supported image file formats and process image- Parameters:
inputStream
- source InputStreamoutputStream
- destination OutpytStreamformat
- image filetype (ie PNG)- Throws:
Exception
- if an error occurs in converting image
-
convert
public static void convert(InputStream inputStream, OutputStream outputStream, String format, com.idrsolutions.image.process.ImageProcessingOps operations) throws Exception Convert between any supported image file formats and process image- Parameters:
inputStream
- source InputStreamoutputStream
- destination OutputStreamoperations
- image processing operations to performformat
- image filetype (ie PNG)- Throws:
Exception
- if an error occurs in converting image
-
convert
Convert between any supported image file formats and process image- Parameters:
inputData
- byte[] containing image dataformat
- image filetype (ie PNG)- Returns:
- byte[] object containing output image data
- Throws:
Exception
- if an error occurs in converting image
-
convert
public static byte[] convert(byte[] inputData, String format, com.idrsolutions.image.process.ImageProcessingOps operations) throws Exception Convert between any supported image file formats and process image- Parameters:
inputData
- byte[] containing image dataoperations
- image processing operations to performformat
- image filetype (ie PNG)- Returns:
- byte[] object containing output image data
- Throws:
Exception
- if an error occurs in converting image
-
convert
public static byte[] convert(byte[] inputData, com.idrsolutions.image.encoder.options.EncoderOptions options) throws Exception Convert between any supported image file formats and process image- Parameters:
inputData
- byte[] containing image dataoptions
- options to use when encoding- Returns:
- byte[] object containing output image data
- Throws:
Exception
- if an error occurs in converting image
-
getImageInfo
public static com.idrsolutions.image.metadata.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 com.idrsolutions.image.metadata.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 com.idrsolutions.image.metadata.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
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
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
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
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
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
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
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
Returns BufferedImage from the File object if supported ImageType- Parameters:
imageFile
- path for image filemap
- map to put custom parameters- Returns:
- BufferedImage
- Throws:
Exception
- if an error occurs in reading image
-
read
Returns BufferedImage from the byte[] if supported ImageType- Parameters:
data
- compressed image data as bytesmap
- map to put custom parameters- Returns:
- BufferedImage
- Throws:
Exception
- if an error occurs in reading image
-
read
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
Returns BufferedImage from InputStream if supported ImageType- Parameters:
is
- input stream to read frommap
- configuration options to apply- Returns:
- BufferedImage
- Throws:
Exception
- if an error occurs in reading image- See Also:
- Implementation Note:
- If you are passing in a ByteArrayInputStream it may be more effective to use our read(byte[], HashMap) method instead
-
read
Returns BufferedImage from InputStream if supported ImageType stream- Parameters:
is
- input stream to read from- Returns:
- BufferedImage
- Throws:
Exception
- if an error occurs in reading image- See Also:
- Implementation Note:
- If you are passing in a ByteArrayInputStream it may be more effective to use our read(byte[]) method instead
-
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
- bufferedImageoptions
- WriterOptionsoutputFile
- output file- Throws:
Exception
- if an error occurs in reading image- See Also:
-
OutputFormat
-
write
public static byte[] write(BufferedImage image, com.idrsolutions.image.encoder.options.EncoderOptions options) throws Exception This method compress the buffered image into given output format- Parameters:
image
- bufferedImageoptions
- WriterOptions- Returns:
- byte[] the data array written out or an empty array if no encoder is found
- Throws:
Exception
- if an error occurs in reading image- 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
- bufferedImageformat
- output formatoutputFile
- output file- Throws:
Exception
- if an error occurs in reading image- See Also:
-
OutputFormat
-
write
This method writes out a BufferedImage to any supported ImageType- Parameters:
image
- bufferedImageformatName
- output format nameoutputFile
- output file- Throws:
Exception
- if an error occurs in writing image- See Also:
-
OutputFormat
-
filter
public static byte[] filter(byte[] raw_data, com.idrsolutions.image.filter.FilterOptions options) throws Exception This method filters the data using the chosen algorithm- Parameters:
raw_data
- byte[]options
- FilterOptions- Returns:
- byte[] the data array written out
- Throws:
Exception
- if an error occurs in filter operation
-
filter
public static void filter(InputStream inputStream, com.idrsolutions.image.filter.FilterOptions options, OutputStream outputStream) throws Exception This method filters the data using the chosen algorithm- Parameters:
inputStream
- InputStreamoptions
- FilterOptionsoutputStream
- OutputStream- Throws:
Exception
- if an error occurs in filter operation- See Also:
-
OutputFormat
-
isImageSupportedForOutput
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
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
This method writes out a BufferedImage to any supported ImageType to a byte[] array- Parameters:
image
- bufferedImageformatName
- output format name- Returns:
- byte[] with output image as bytes
- Throws:
Exception
- if an error occurs in writing image
-
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
- bufferedImageformatName
- output format namestream
- output stream- Throws:
Exception
- if an error occurs in writing image
-
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 formatThis 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
- bufferedImageoptions
- WriterOptionsoutputStream
- outputStream- Throws:
Exception
- if an error occurs in writing image- 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 formatThis 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
- bufferedImageformat
- output formatoutputStream
- outputStream- Throws:
Exception
- if an error occurs in writing image- See Also:
-
OutputFormat
-