public final class ImageIOUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
LOG
Log instance
|
Modifier | Constructor and Description |
---|---|
private |
ImageIOUtil() |
Modifier and Type | Method and Description |
---|---|
private static javax.imageio.metadata.IIOMetadataNode |
getOrCreateChildNode(javax.imageio.metadata.IIOMetadataNode parentNode,
java.lang.String name)
Gets the named child node, or creates and attaches it.
|
private static void |
setDPI(javax.imageio.metadata.IIOMetadata metadata,
int dpi,
java.lang.String formatName) |
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String filename,
int dpi)
Writes a buffered image to a file using the given image format.
|
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String filename,
int dpi,
float compressionQuality)
Writes a buffered image to a file using the given image format.
|
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String formatName,
java.io.OutputStream output)
Writes a buffered image to a file using the given image format.
|
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String formatName,
java.io.OutputStream output,
int dpi)
Writes a buffered image to a file using the given image format.
|
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String formatName,
java.io.OutputStream output,
int dpi,
float compressionQuality)
Writes a buffered image to a file using the given image format.
|
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String formatName,
java.io.OutputStream output,
int dpi,
float compressionQuality,
java.lang.String compressionType)
Writes a buffered image to a file using the given image format.
|
static boolean |
writeImage(java.awt.image.BufferedImage image,
java.lang.String formatName,
java.lang.String filename,
int dpi)
Deprecated.
use
writeImage(BufferedImage image, String filename, int dpi) , which
uses the full filename instead of just the prefix. |
public static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String filename, int dpi) throws java.io.IOException
writeImage(BufferedImage image, String formatName, OutputStream output, int dpi, float compressionQuality)
for more details.image
- the image to be writtenfilename
- used to construct the filename for the individual image.
Its suffix will be used as the image format.dpi
- the resolution in dpi (dots per inch) to be used in metadatajava.io.IOException
- if an I/O error occurspublic static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String filename, int dpi, float compressionQuality) throws java.io.IOException
writeImage(BufferedImage image, String formatName,
OutputStream output, int dpi, float compressionQuality)
for more details.image
- the image to be writtenfilename
- used to construct the filename for the individual image. Its suffix will be
used as the image format.dpi
- the resolution in dpi (dots per inch) to be used in metadatacompressionQuality
- quality to be used when compressing the image (0 <
compressionQuality < 1.0f). See ImageWriteParam.setCompressionQuality(float)
for
more details.java.io.IOException
- if an I/O error occurs@Deprecated public static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String formatName, java.lang.String filename, int dpi) throws java.io.IOException
writeImage(BufferedImage image, String filename, int dpi)
, which
uses the full filename instead of just the prefix.writeImage(BufferedImage image, String formatName,
OutputStream output, int dpi, float compressionQuality)
for more details.image
- the image to be writtenformatName
- the target format (ex. "png") which is also the suffix
for the filenamefilename
- used to construct the filename for the individual image.
The formatName parameter will be used as the suffix.dpi
- the resolution in dpi (dots per inch) to be used in metadatajava.io.IOException
- if an I/O error occurspublic static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String formatName, java.io.OutputStream output) throws java.io.IOException
writeImage(BufferedImage image, String formatName, OutputStream output, int dpi, float compressionQuality)
for more details.image
- the image to be writtenformatName
- the target format (ex. "png")output
- the output stream to be used for writingjava.io.IOException
- if an I/O error occurspublic static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String formatName, java.io.OutputStream output, int dpi) throws java.io.IOException
writeImage(BufferedImage image, String formatName, OutputStream output, int dpi, float compressionQuality)
for more details.image
- the image to be writtenformatName
- the target format (ex. "png")output
- the output stream to be used for writingdpi
- the resolution in dpi (dots per inch) to be used in metadatajava.io.IOException
- if an I/O error occurspublic static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String formatName, java.io.OutputStream output, int dpi, float compressionQuality) throws java.io.IOException
image
- the image to be writtenformatName
- the target format (ex. "png")output
- the output stream to be used for writingdpi
- the resolution in dpi (dots per inch) to be used in metadatacompressionQuality
- quality to be used when compressing the image (0 <
compressionQuality < 1.0f). See ImageWriteParam.setCompressionQuality(float)
for
more details.java.io.IOException
- if an I/O error occurspublic static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String formatName, java.io.OutputStream output, int dpi, float compressionQuality, java.lang.String compressionType) throws java.io.IOException
image
- the image to be writtenformatName
- the target format (ex. "png")output
- the output stream to be used for writingdpi
- the resolution in dpi (dots per inch) to be used in metadatacompressionQuality
- quality to be used when compressing the image (0 <
compressionQuality < 1.0f). See ImageWriteParam.setCompressionQuality(float)
for
more details.compressionType
- Advanced users only, and only relevant for TIFF
files: If null, save uncompressed; if empty string, use logic explained
above; other valid values are found in the javadoc of
TIFFImageWriteParam.java.io.IOException
- if an I/O error occursprivate static javax.imageio.metadata.IIOMetadataNode getOrCreateChildNode(javax.imageio.metadata.IIOMetadataNode parentNode, java.lang.String name)
parentNode
- the parent nodename
- name of the child nodeprivate static void setDPI(javax.imageio.metadata.IIOMetadata metadata, int dpi, java.lang.String formatName) throws javax.imageio.metadata.IIOInvalidTreeException
javax.imageio.metadata.IIOInvalidTreeException