public class TiffDirectory extends TiffElement
| Modifier and Type | Class and Description |
|---|---|
static class |
TiffDirectory.ImageDataElement |
TiffElement.DataElement, TiffElement.Stub| Modifier and Type | Field and Description |
|---|---|
List<TiffField> |
entries |
long |
nextDirectoryOffset |
int |
type |
COMPARATOR, length, offset| Constructor and Description |
|---|
TiffDirectory(int type,
List<TiffField> entries,
long offset,
long nextDirectoryOffset,
ByteOrder byteOrder) |
public String description()
public String getElementDescription()
getElementDescription in class TiffElementpublic static String description(int type)
public void dump()
public boolean hasJpegImageData()
throws ImageReadException
ImageReadExceptionpublic boolean hasTiffImageData()
throws ImageReadException
ImageReadExceptionpublic BufferedImage getTiffImage() throws ImageReadException, IOException
ImageReadException - in the event of an invalid or incompatible
data format.IOException - in the event of an I/O error.public BufferedImage getTiffImage(Map<String,Object> params) throws ImageReadException, IOException
The optional parameters map can be used to specify image access or rendering options such as reading only a part of the overall image (i.e. reading a sub-image) or applying a custom photometric interpreter.
params - a map containing optional parameters to be applied to the
read operation.ImageReadException - in the event of an invalid or incompatible
data format.IOException - in the event of an I/O error.public BufferedImage getTiffImage(ByteOrder byteOrder) throws ImageReadException, IOException
This method comes from an older version of this class in which byte order was required from an external source. Developers are encouraged to use the simpler version of getTiffImage that does not require the byte-order argument.
byteOrder - byte-order obtained from the containing TIFF fileImageReadException - in the event of an invalid or incompatible
data format.IOException - in the event of an I/O error.public BufferedImage getTiffImage(ByteOrder byteOrder, Map<String,Object> params) throws ImageReadException, IOException
This method comes from an older version of this class in which byte order was required from an external source. Developers are encouraged to use the simpler version of getTiffImage that does not require the byte-order argument.
byteOrder - byte-order obtained from the containing TIFF fileparams - a map containing optional parameters to be applied to the
read operation.ImageReadException - in the event of an invalid or incompatible
data format.IOException - in the event of an I/O error.public TiffField findField(TagInfo tag) throws ImageReadException
ImageReadExceptionpublic TiffField findField(TagInfo tag, boolean failIfMissing) throws ImageReadException
ImageReadExceptionpublic Object getFieldValue(TagInfo tag) throws ImageReadException
ImageReadExceptionpublic String getSingleFieldValue(TagInfoAscii tag) throws ImageReadException
ImageReadExceptionpublic int getSingleFieldValue(TagInfoShortOrLong tag) throws ImageReadException
ImageReadExceptionpublic byte getFieldValue(TagInfoByte tag) throws ImageReadException
ImageReadExceptionpublic byte[] getFieldValue(TagInfoBytes tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic String[] getFieldValue(TagInfoAscii tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic short getFieldValue(TagInfoShort tag) throws ImageReadException
ImageReadExceptionpublic short[] getFieldValue(TagInfoShorts tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic int getFieldValue(TagInfoLong tag) throws ImageReadException
ImageReadExceptionpublic int[] getFieldValue(TagInfoLongs tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic int[] getFieldValue(TagInfoShortOrLong tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic RationalNumber getFieldValue(TagInfoRational tag) throws ImageReadException
ImageReadExceptionpublic RationalNumber[] getFieldValue(TagInfoRationals tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic byte getFieldValue(TagInfoSByte tag) throws ImageReadException
ImageReadExceptionpublic byte[] getFieldValue(TagInfoSBytes tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic short getFieldValue(TagInfoSShort tag) throws ImageReadException
ImageReadExceptionpublic short[] getFieldValue(TagInfoSShorts tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic int getFieldValue(TagInfoSLong tag) throws ImageReadException
ImageReadExceptionpublic int[] getFieldValue(TagInfoSLongs tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic RationalNumber getFieldValue(TagInfoSRational tag) throws ImageReadException
ImageReadExceptionpublic RationalNumber[] getFieldValue(TagInfoSRationals tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic float getFieldValue(TagInfoFloat tag) throws ImageReadException
ImageReadExceptionpublic float[] getFieldValue(TagInfoFloats tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic double getFieldValue(TagInfoDouble tag) throws ImageReadException
ImageReadExceptionpublic double[] getFieldValue(TagInfoDoubles tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic String getFieldValue(TagInfoGpsText tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic String getFieldValue(TagInfoXpString tag, boolean mustExist) throws ImageReadException
ImageReadExceptionpublic List<TiffDirectory.ImageDataElement> getTiffRawImageDataElements() throws ImageReadException
ImageReadExceptionpublic boolean imageDataInStrips()
throws ImageReadException
ImageReadExceptionpublic TiffDirectory.ImageDataElement getJpegRawImageDataElement() throws ImageReadException
ImageReadExceptionpublic void setTiffImageData(TiffImageData rawImageData)
public TiffImageData getTiffImageData()
public void setJpegImageData(JpegImageData value)
public JpegImageData getJpegImageData()
public TiffRasterData getFloatingPointRasterData(Map<String,Object> params) throws ImageReadException, IOException
TIFF directories that provide floating-point data do not directly specify images, though it is possible to interpret the data as an image using this library. TIFF files may contain multiple directories which are allowed to have different formats. Thus it is possible for a TIFF file to contain a mix of image and floating-point raster data.
If desired, sub-image data can be read from the file by using a Java Map instance to specify the subsection of the image that is required. The following code illustrates the approach:
int x; // coordinate (column) of corner of sub-image
int y; // coordinate (row) of corner of sub-image
int width; // width of sub-image
int height; // height of sub-image
Map<String, Object>params = new HashMap<>();
params.put(TiffConstants.PARAM_KEY_SUBIMAGE_X, x);
params.put(TiffConstants.PARAM_KEY_SUBIMAGE_Y, y);
params.put(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, width);
params.put(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, height);
TiffRasterData raster =
directory.readFloatingPointRasterData(params);
params - an optional parameter map instanceImageReadException - in the event of incompatible or malformed dataIOException - in the event of an I/O errorpublic boolean hasTiffFloatingPointRasterData()
throws ImageReadException
ImageReadException - in the event of an invalid or malformed
specification.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.