org.apache.pdfbox.util
Class ImageIOUtil

java.lang.Object
  extended by org.apache.pdfbox.util.ImageIOUtil

public class ImageIOUtil
extends java.lang.Object

This class handles some ImageIO operations.

Version:
$Revision$

Field Summary
static float DEFAULT_COMPRESSION_QUALITY
          Default compression quality: 1.0f.
static int DEFAULT_SCREEN_RESOLUTION
          Default screen resolution: 72dpi.
 
Method Summary
static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String imageFormat, java.lang.Object outputStream, int resolution)
          Writes a buffered image to a file using the given image format.
static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String imageFormat, java.lang.Object outputStream, int resolution, float quality)
          Writes a buffered image to a file using the given image format.
static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String imageFormat, java.io.OutputStream outputStream)
          Writes a buffered image to a file using the given image format.
static boolean writeImage(java.awt.image.BufferedImage image, java.lang.String imageFormat, java.lang.String filename, int imageType, int resolution)
          Writes a buffered image to a file using the given image format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SCREEN_RESOLUTION

public static final int DEFAULT_SCREEN_RESOLUTION
Default screen resolution: 72dpi.

See Also:
Constant Field Values

DEFAULT_COMPRESSION_QUALITY

public static final float DEFAULT_COMPRESSION_QUALITY
Default compression quality: 1.0f.

See Also:
Constant Field Values
Method Detail

writeImage

public static boolean writeImage(java.awt.image.BufferedImage image,
                                 java.lang.String imageFormat,
                                 java.lang.String filename,
                                 int imageType,
                                 int resolution)
                          throws java.io.IOException
Writes a buffered image to a file using the given image format.

Parameters:
image - the image to be written
imageFormat - the target format (ex. "png")
filename - used to construct the filename for the individual images
imageType - the image type (see BufferedImage.TYPE_*)
resolution - the resolution in dpi (dots per inch)
Returns:
true if the images were produced, false if there was an error
Throws:
java.io.IOException - if an I/O error occurs

writeImage

public static boolean writeImage(java.awt.image.BufferedImage image,
                                 java.lang.String imageFormat,
                                 java.io.OutputStream outputStream)
                          throws java.io.IOException
Writes a buffered image to a file using the given image format.

Parameters:
image - the image to be written
imageFormat - the target format (ex. "png")
outputStream - the output stream to be used for writing
Returns:
true if the images were produced, false if there was an error
Throws:
java.io.IOException - if an I/O error occurs

writeImage

public static boolean writeImage(java.awt.image.BufferedImage image,
                                 java.lang.String imageFormat,
                                 java.lang.Object outputStream,
                                 int resolution)
                          throws java.io.IOException
Writes a buffered image to a file using the given image format.

Parameters:
image - the image to be written
imageFormat - the target format (ex. "png")
outputStream - the output stream to be used for writing
resolution - resolution to be used when writing the image
Returns:
true if the images were produced, false if there was an error
Throws:
java.io.IOException - if an I/O error occurs

writeImage

public static boolean writeImage(java.awt.image.BufferedImage image,
                                 java.lang.String imageFormat,
                                 java.lang.Object outputStream,
                                 int resolution,
                                 float quality)
                          throws java.io.IOException
Writes a buffered image to a file using the given image format.

Parameters:
image - the image to be written
imageFormat - the target format (ex. "png")
outputStream - the output stream to be used for writing
resolution - resolution to be used when writing the image
quality - quality to be used when compressing the image (0 < quality < 1.0f)
Returns:
true if the images were produced, false if there was an error
Throws:
java.io.IOException - if an I/O error occurs