throw new IllegalStateException(
"Invalid compression scheme: " + compression);
}
}
ImageContent content = imageObj.getImageSegment().getImageContent();
int bitsPerPixel = imageObjectInfo.getBitsPerPixel();
imageObj.setIDESize((byte) bitsPerPixel);
IDEStructureParameter ideStruct;
switch (bitsPerPixel) {
case 1:
//Skip IDE Structure Parameter
break;
case 4:
case 8:
//A grayscale image
ideStruct = content.needIDEStructureParameter();
ideStruct.setBitsPerComponent(new int[] {bitsPerPixel});
ideStruct.setColorModel(IDEStructureParameter.COLOR_MODEL_YCBCR);
break;
case 24:
ideStruct = content.needIDEStructureParameter();
ideStruct.setDefaultRGBColorModel();
break;
case 32:
ideStruct = content.needIDEStructureParameter();
ideStruct.setDefaultCMYKColorModel();
break;
default:
throw new IllegalArgumentException("Unsupported number of bits per pixel: "
+ bitsPerPixel);
}
if (bitsPerPixel > 1 && imageObjectInfo.isSubtractive()) {
ideStruct = content.needIDEStructureParameter();
ideStruct.setSubtractive(imageObjectInfo.isSubtractive());
}
imageObj.setData(imageObjectInfo.getData());