org.apache.sanselan
Class ImageInfo

java.lang.Object
  extended by org.apache.sanselan.ImageInfo
Direct Known Subclasses:
PngImageInfo

public class ImageInfo
extends java.lang.Object

ImageInfo represents a collection of basic properties of an image, such as width, height, format, bit depth, etc.


Field Summary
static int COLOR_TYPE_BW
           
static int COLOR_TYPE_CMYK
           
static int COLOR_TYPE_GRAYSCALE
           
static int COLOR_TYPE_OTHER
           
static int COLOR_TYPE_RGB
           
static int COLOR_TYPE_UNKNOWN
           
static java.lang.String COMPRESSION_ALGORITHM_CCITT_1D
           
static java.lang.String COMPRESSION_ALGORITHM_CCITT_GROUP_3
           
static java.lang.String COMPRESSION_ALGORITHM_CCITT_GROUP_4
           
static java.lang.String COMPRESSION_ALGORITHM_JPEG
           
static java.lang.String COMPRESSION_ALGORITHM_LZW
           
static java.lang.String COMPRESSION_ALGORITHM_NONE
           
static java.lang.String COMPRESSION_ALGORITHM_PACKBITS
           
static java.lang.String COMPRESSION_ALGORITHM_PNG_FILTER
           
static java.lang.String COMPRESSION_ALGORITHM_PSD
           
static java.lang.String COMPRESSION_ALGORITHM_RLE
           
static java.lang.String COMPRESSION_ALGORITHM_UNKNOWN
           
 
Constructor Summary
ImageInfo(java.lang.String formatDetails, int bitsPerPixel, java.util.ArrayList comments, ImageFormat format, java.lang.String formatName, int height, java.lang.String mimeType, int numberOfImages, int physicalHeightDpi, float physicalHeightInch, int physicalWidthDpi, float physicalWidthInch, int width, boolean isProgressive, boolean isTransparent, boolean usesPalette, int colorType, java.lang.String compressionAlgorithm)
           
 
Method Summary
 void dump()
           
 int getBitsPerPixel()
          Returns the bits per pixel of the image data.
 int getColorType()
          Returns the color type of the image, as a constant (ie.
 java.lang.String getColorTypeDescription()
          Returns a description of the color type of the image.
 java.util.ArrayList getComments()
          Returns a list of comments from the image file.
 ImageFormat getFormat()
          Returns the image file format, ie.
 java.lang.String getFormatName()
          Returns a string with the name of the image file format.
 int getHeight()
          Returns the height of the image in pixels.
 boolean getIsProgressive()
          Returns true if the image is progressive or interlaced.
 java.lang.String getMimeType()
          Returns the MIME type of the image.
 int getNumberOfImages()
          Returns the number of images in the file.
 int getPhysicalHeightDpi()
          Returns horizontal dpi of the image, if available.
 float getPhysicalHeightInch()
          Returns physical height of the image in inches, if available.
 int getPhysicalWidthDpi()
          Returns vertical dpi of the image, if available.
 float getPhysicalWidthInch()
          Returns physical width of the image in inches, if available.
 int getWidth()
          Returns the width of the image in pixels.
 java.lang.String toString()
           
 void toString(java.io.PrintWriter pw, java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLOR_TYPE_BW

public static final int COLOR_TYPE_BW
See Also:
Constant Field Values

COLOR_TYPE_GRAYSCALE

public static final int COLOR_TYPE_GRAYSCALE
See Also:
Constant Field Values

COLOR_TYPE_RGB

public static final int COLOR_TYPE_RGB
See Also:
Constant Field Values

COLOR_TYPE_CMYK

public static final int COLOR_TYPE_CMYK
See Also:
Constant Field Values

COLOR_TYPE_OTHER

public static final int COLOR_TYPE_OTHER
See Also:
Constant Field Values

COLOR_TYPE_UNKNOWN

public static final int COLOR_TYPE_UNKNOWN
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_UNKNOWN

public static final java.lang.String COMPRESSION_ALGORITHM_UNKNOWN
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_NONE

public static final java.lang.String COMPRESSION_ALGORITHM_NONE
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_LZW

public static final java.lang.String COMPRESSION_ALGORITHM_LZW
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_PACKBITS

public static final java.lang.String COMPRESSION_ALGORITHM_PACKBITS
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_JPEG

public static final java.lang.String COMPRESSION_ALGORITHM_JPEG
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_RLE

public static final java.lang.String COMPRESSION_ALGORITHM_RLE
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_PSD

public static final java.lang.String COMPRESSION_ALGORITHM_PSD
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_PNG_FILTER

public static final java.lang.String COMPRESSION_ALGORITHM_PNG_FILTER
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_CCITT_GROUP_3

public static final java.lang.String COMPRESSION_ALGORITHM_CCITT_GROUP_3
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_CCITT_GROUP_4

public static final java.lang.String COMPRESSION_ALGORITHM_CCITT_GROUP_4
See Also:
Constant Field Values

COMPRESSION_ALGORITHM_CCITT_1D

public static final java.lang.String COMPRESSION_ALGORITHM_CCITT_1D
See Also:
Constant Field Values
Constructor Detail

ImageInfo

public ImageInfo(java.lang.String formatDetails,
                 int bitsPerPixel,
                 java.util.ArrayList comments,
                 ImageFormat format,
                 java.lang.String formatName,
                 int height,
                 java.lang.String mimeType,
                 int numberOfImages,
                 int physicalHeightDpi,
                 float physicalHeightInch,
                 int physicalWidthDpi,
                 float physicalWidthInch,
                 int width,
                 boolean isProgressive,
                 boolean isTransparent,
                 boolean usesPalette,
                 int colorType,
                 java.lang.String compressionAlgorithm)
Method Detail

getBitsPerPixel

public int getBitsPerPixel()
Returns the bits per pixel of the image data.


getComments

public java.util.ArrayList getComments()
Returns a list of comments from the image file.

This is mostly obsolete.


getFormat

public ImageFormat getFormat()
Returns the image file format, ie. ImageFormat.IMAGE_FORMAT_PNG.

Returns ImageFormat.IMAGE_FORMAT_UNKNOWN if format is unknown.

Returns:
A constant defined in ImageFormat.
See Also:
ImageFormat

getFormatName

public java.lang.String getFormatName()
Returns a string with the name of the image file format.

See Also:
getFormat()

getHeight

public int getHeight()
Returns the height of the image in pixels.

See Also:
getWidth()

getMimeType

public java.lang.String getMimeType()
Returns the MIME type of the image.

See Also:
getFormat()

getNumberOfImages

public int getNumberOfImages()
Returns the number of images in the file.

Applies mostly to GIF and TIFF; reading PSD/Photoshop layers is not supported, and Jpeg/JFIF EXIF thumbnails are not included in this count.


getPhysicalHeightDpi

public int getPhysicalHeightDpi()
Returns horizontal dpi of the image, if available.

Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant: 72).

Returns:
returns -1 if not present.

getPhysicalHeightInch

public float getPhysicalHeightInch()
Returns physical height of the image in inches, if available.

Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant: 72).

Returns:
returns -1 if not present.

getPhysicalWidthDpi

public int getPhysicalWidthDpi()
Returns vertical dpi of the image, if available.

Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant: 72).

Returns:
returns -1 if not present.

getPhysicalWidthInch

public float getPhysicalWidthInch()
Returns physical width of the image in inches, if available.

Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant: 72).

Returns:
returns -1 if not present.

getWidth

public int getWidth()
Returns the width of the image in pixels.

See Also:
getHeight()

getIsProgressive

public boolean getIsProgressive()
Returns true if the image is progressive or interlaced.


getColorType

public int getColorType()
Returns the color type of the image, as a constant (ie. ImageFormat.COLOR_TYPE_CMYK).

See Also:
getColorTypeDescription()

getColorTypeDescription

public java.lang.String getColorTypeDescription()
Returns a description of the color type of the image.

See Also:
getColorType()

dump

public void dump()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public void toString(java.io.PrintWriter pw,
                     java.lang.String prefix)
              throws ImageReadException,
                     java.io.IOException
Throws:
ImageReadException
java.io.IOException


Copyright © 2007-2009. All Rights Reserved.