throws ImageReadException, IOException
{
ArrayList entries = directory.entries;
if (entries == null)
throw new ImageReadException("TIFF missing entries");
int photometricInterpretation = directory.findField(
TIFF_TAG_PHOTOMETRIC_INTERPRETATION, true).getIntValue();
int compression = directory.findField(TIFF_TAG_COMPRESSION, true)
.getIntValue();
int width = directory.findField(TIFF_TAG_IMAGE_WIDTH, true)
.getIntValue();
int height = directory.findField(TIFF_TAG_IMAGE_LENGTH, true)
.getIntValue();
int samplesPerPixel = directory.findField(TIFF_TAG_SAMPLES_PER_PIXEL,
true).getIntValue();
int bitsPerSample[] = directory.findField(TIFF_TAG_BITS_PER_SAMPLE,
true).getIntArrayValue();
// TODO: why are we using bits per sample twice? because one is a sum.
int bitsPerPixel = directory.findField(TIFF_TAG_BITS_PER_SAMPLE, true)
.getIntValueOrArraySum();
// int bitsPerPixel = getTagAsValueOrArraySum(entries,
// TIFF_TAG_BITS_PER_SAMPLE);
int predictor = -1;
{
// dumpOptionalNumberTag(entries, TIFF_TAG_FILL_ORDER);
// dumpOptionalNumberTag(entries, TIFF_TAG_FREE_BYTE_COUNTS);
// dumpOptionalNumberTag(entries, TIFF_TAG_FREE_OFFSETS);
// dumpOptionalNumberTag(entries, TIFF_TAG_ORIENTATION);
// dumpOptionalNumberTag(entries, TIFF_TAG_PLANAR_CONFIGURATION);
TiffField predictorField = directory.findField(TIFF_TAG_PREDICTOR);
if (null != predictorField)
predictor = predictorField.getIntValueOrArraySum();
}
if (samplesPerPixel != bitsPerSample.length)
throw new ImageReadException("Tiff: samplesPerPixel ("
+ samplesPerPixel + ")!=fBitsPerSample.length ("
+ bitsPerSample.length + ")");
boolean hasAlpha = false;
BufferedImage result = getBufferedImageFactory(params)