.getIntArrayValue();
int expected_colormap_size = 3 * (1 << bitsPerPixel);
if (colorMap.length != expected_colormap_size)
throw new ImageReadException("Tiff: fColorMap.length ("
+ colorMap.length + ")!=expected_colormap_size ("
+ expected_colormap_size + ")");
return new PhotometricInterpreterPalette(samplesPerPixel,
bitsPerSample, predictor, width, height, colorMap);
}
case 2: // RGB
return new PhotometricInterpreterRGB(samplesPerPixel,
bitsPerSample, predictor, width, height);
case 5: // CMYK
return new PhotometricInterpreterCMYK(samplesPerPixel,
bitsPerSample, predictor, width, height);
case 6: //
{
double yCbCrCoefficients[] = directory.findField(
TIFF_TAG_YCBCR_COEFFICIENTS, true).getDoubleArrayValue();
int yCbCrPositioning[] = directory.findField(
TIFF_TAG_YCBCR_POSITIONING, true).getIntArrayValue();
int yCbCrSubSampling[] = directory.findField(
TIFF_TAG_YCBCR_SUB_SAMPLING, true).getIntArrayValue();
double referenceBlackWhite[] = directory.findField(
TIFF_TAG_REFERENCE_BLACK_WHITE, true).getDoubleArrayValue();
return new PhotometricInterpreterYCbCr(yCbCrCoefficients,
yCbCrPositioning, yCbCrSubSampling, referenceBlackWhite,
samplesPerPixel, bitsPerSample, predictor, width, height);
}
case 8:
return new PhotometricInterpreterCIELAB(samplesPerPixel,
bitsPerSample, predictor, width, height);
case 32844:
case 32845: {
boolean yonly = (photometricInterpretation == 32844);
return new PhotometricInterpreterLogLUV(samplesPerPixel,
bitsPerSample, predictor, width, height, yonly);
}
default:
throw new ImageReadException(
"TIFF: Unknown fPhotometricInterpretation: "
+ photometricInterpretation);
}
}