Class ImageInfo
- Direct Known Subclasses:
PngImageInfo
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final ImageInfo.ColorType
private final ImageInfo.CompressionAlgorithm
private final ImageFormat
private final String
private final String
private final int
private static final Logger
private final String
private final int
private final int
private final float
private final int
private final float
private final boolean
private final boolean
private final boolean
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionImageInfo
(String formatDetails, int bitsPerPixel, List<String> comments, ImageFormat format, String formatName, int height, String mimeType, int numberOfImages, int physicalHeightDpi, float physicalHeightInch, int physicalWidthDpi, float physicalWidthInch, int width, boolean progressive, boolean transparent, boolean usesPalette, ImageInfo.ColorType colorType, ImageInfo.CompressionAlgorithm compressionAlgorithm) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump()
int
Returns the bits per pixel of the image data.Returns theImageInfo.ColorType
of the image.Returns a list of comments from the image file.Returns a description of the compression algorithm, if any.Returns the image file format, ie.Returns a description of the file format, ie.Returns a string with the name of the image file format.int
Returns the height of the image in pixels.Returns the MIME type of the image.int
Returns the number of images in the file.int
Returns horizontal dpi of the image, if available.float
Returns physical height of the image in inches, if available.int
Returns vertical dpi of the image, if available.float
Returns physical width of the image in inches, if available.int
getWidth()
Returns the width of the image in pixels.boolean
Returns true if the image is progressive or interlaced.boolean
Returns true if the image has transparency.toString()
void
toString
(PrintWriter pw, String prefix) boolean
Returns true if the image uses a palette.
-
Field Details
-
LOGGER
-
formatDetails
-
bitsPerPixel
private final int bitsPerPixel -
comments
-
format
-
formatName
-
height
private final int height -
mimeType
-
numberOfImages
private final int numberOfImages -
physicalHeightDpi
private final int physicalHeightDpi -
physicalHeightInch
private final float physicalHeightInch -
physicalWidthDpi
private final int physicalWidthDpi -
physicalWidthInch
private final float physicalWidthInch -
width
private final int width -
progressive
private final boolean progressive -
transparent
private final boolean transparent -
usesPalette
private final boolean usesPalette -
colorType
-
compressionAlgorithm
-
-
Constructor Details
-
ImageInfo
public ImageInfo(String formatDetails, int bitsPerPixel, List<String> comments, ImageFormat format, String formatName, int height, String mimeType, int numberOfImages, int physicalHeightDpi, float physicalHeightInch, int physicalWidthDpi, float physicalWidthInch, int width, boolean progressive, boolean transparent, boolean usesPalette, ImageInfo.ColorType colorType, ImageInfo.CompressionAlgorithm compressionAlgorithm)
-
-
Method Details
-
getBitsPerPixel
public int getBitsPerPixel()Returns the bits per pixel of the image data.- Returns:
- bits per pixel of the image data.
-
getComments
Returns a list of comments from the image file.This is mostly obsolete.
- Returns:
- A list of comments.
-
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:
-
getFormatName
Returns a string with the name of the image file format.- Returns:
- the name of the image file format.
- See Also:
-
getHeight
public int getHeight()Returns the height of the image in pixels.- Returns:
- image height in pixels.
- See Also:
-
getMimeType
Returns the MIME type of the image.- Returns:
- image MIME type.
- See Also:
-
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.
- Returns:
- number of images in the file.
-
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.- Returns:
- image width in pixels.
- See Also:
-
isProgressive
public boolean isProgressive()Returns true if the image is progressive or interlaced.- Returns:
true
if the image is progressive or interlaced,false
otherwise.
-
getColorType
Returns theImageInfo.ColorType
of the image.- Returns:
- image color type.
-
dump
public void dump() -
toString
-
toString
-
getFormatDetails
Returns a description of the file format, ie. format version.- Returns:
- file format description.
-
isTransparent
public boolean isTransparent()Returns true if the image has transparency.- Returns:
true
if the image has transparency,false
otherwise.
-
usesPalette
public boolean usesPalette()Returns true if the image uses a palette.- Returns:
true
if the image uses a palette,false
otherwise.
-
getCompressionAlgorithm
Returns a description of the compression algorithm, if any.- Returns:
- compression algorithm description.
-