PDColorSpace colorspace = getColorSpace();
// most likely there is no colorspace as a CCITT-filter uses 1-bit values mapped to black/white
// in some rare cases other colorspaces maybe used such as an indexed colorspace, see PDFBOX-1638
if (colorspace instanceof PDIndexed)
{
PDIndexed csIndexed = (PDIndexed) colorspace;
COSBase maskArray = getMask();
if (maskArray != null && maskArray instanceof COSArray)
{
colorModel = csIndexed.createColorModel(1, ((COSArray) maskArray).getInt(0));
}
else
{
colorModel = csIndexed.createColorModel(1);
}
}
else
{
byte[] map = new byte[] { (byte) 0x00, (byte) 0xFF };