private List<PDColorSpace> getImageCS() {
if (this.jpeg2000List == null) {
this.jpeg2000List = parseJPXStream();
}
PDImageXObjectProxy image = (PDImageXObjectProxy) this.simplePDObject;
if (!image.isStencil()) {
try {
PDColorSpace buffer = ColorSpaceFactory.getColorSpace(image.getColorSpace(),
null, resources, 0, false, this.document, this.flavour);
if (buffer == null) {
buffer = this.colorSpaceFromImage;
}
if (buffer != null) {
List<PDColorSpace> colorSpaces = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
colorSpaces.add(buffer);
return Collections.unmodifiableList(colorSpaces);
}
} catch (IOException e) {
LOGGER.debug("Could not obtain Image XObject color space. " + e.getMessage(), e);
}
}
return Collections.emptyList();
}