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 TiffElement
public static String description(int type)
public void dump()
public boolean hasJpegImageData() throws ImageReadException
ImageReadException
public boolean hasTiffImageData() throws ImageReadException
ImageReadException
public 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
ImageReadException
public TiffField findField(TagInfo tag, boolean failIfMissing) throws ImageReadException
ImageReadException
public Object getFieldValue(TagInfo tag) throws ImageReadException
ImageReadException
public String getSingleFieldValue(TagInfoAscii tag) throws ImageReadException
ImageReadException
public int getSingleFieldValue(TagInfoShortOrLong tag) throws ImageReadException
ImageReadException
public byte getFieldValue(TagInfoByte tag) throws ImageReadException
ImageReadException
public byte[] getFieldValue(TagInfoBytes tag, boolean mustExist) throws ImageReadException
ImageReadException
public String[] getFieldValue(TagInfoAscii tag, boolean mustExist) throws ImageReadException
ImageReadException
public short getFieldValue(TagInfoShort tag) throws ImageReadException
ImageReadException
public short[] getFieldValue(TagInfoShorts tag, boolean mustExist) throws ImageReadException
ImageReadException
public int getFieldValue(TagInfoLong tag) throws ImageReadException
ImageReadException
public int[] getFieldValue(TagInfoLongs tag, boolean mustExist) throws ImageReadException
ImageReadException
public int[] getFieldValue(TagInfoShortOrLong tag, boolean mustExist) throws ImageReadException
ImageReadException
public RationalNumber getFieldValue(TagInfoRational tag) throws ImageReadException
ImageReadException
public RationalNumber[] getFieldValue(TagInfoRationals tag, boolean mustExist) throws ImageReadException
ImageReadException
public byte getFieldValue(TagInfoSByte tag) throws ImageReadException
ImageReadException
public byte[] getFieldValue(TagInfoSBytes tag, boolean mustExist) throws ImageReadException
ImageReadException
public short getFieldValue(TagInfoSShort tag) throws ImageReadException
ImageReadException
public short[] getFieldValue(TagInfoSShorts tag, boolean mustExist) throws ImageReadException
ImageReadException
public int getFieldValue(TagInfoSLong tag) throws ImageReadException
ImageReadException
public int[] getFieldValue(TagInfoSLongs tag, boolean mustExist) throws ImageReadException
ImageReadException
public RationalNumber getFieldValue(TagInfoSRational tag) throws ImageReadException
ImageReadException
public RationalNumber[] getFieldValue(TagInfoSRationals tag, boolean mustExist) throws ImageReadException
ImageReadException
public float getFieldValue(TagInfoFloat tag) throws ImageReadException
ImageReadException
public float[] getFieldValue(TagInfoFloats tag, boolean mustExist) throws ImageReadException
ImageReadException
public double getFieldValue(TagInfoDouble tag) throws ImageReadException
ImageReadException
public double[] getFieldValue(TagInfoDoubles tag, boolean mustExist) throws ImageReadException
ImageReadException
public String getFieldValue(TagInfoGpsText tag, boolean mustExist) throws ImageReadException
ImageReadException
public String getFieldValue(TagInfoXpString tag, boolean mustExist) throws ImageReadException
ImageReadException
public List<TiffDirectory.ImageDataElement> getTiffRawImageDataElements() throws ImageReadException
ImageReadException
public boolean imageDataInStrips() throws ImageReadException
ImageReadException
public TiffDirectory.ImageDataElement getJpegRawImageDataElement() throws ImageReadException
ImageReadException
public 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.