private void decodeImageBytes() throws IOException{
if (streamContentType != null)
throw new IllegalStateException(MessageLocalization.getComposedMessage("Decoding.can't.happen.on.this.type.of.stream.(.1.)", streamContentType));
pngColorType = -1;
PdfArray decode = dictionary.getAsArray(PdfName.DECODE);
width = dictionary.getAsNumber(PdfName.WIDTH).intValue();
height = dictionary.getAsNumber(PdfName.HEIGHT).intValue();
bpc = dictionary.getAsNumber(PdfName.BITSPERCOMPONENT).intValue();
pngBitDepth = bpc;
PdfObject colorspace = dictionary.getDirectObject(PdfName.COLORSPACE);
if (colorspace instanceof PdfName && colorSpaceDic != null){
PdfObject csLookup = colorSpaceDic.getDirectObject((PdfName)colorspace);
if (csLookup != null)
colorspace = csLookup;
}
palette = null;
icc = null;
stride = 0;
findColorspace(colorspace, true);
ByteArrayOutputStream ms = new ByteArrayOutputStream();
if (pngColorType < 0) {
if (bpc != 8)
throw new UnsupportedPdfException(MessageLocalization.getComposedMessage("the.color.depth.1.is.not.supported", bpc));
if (PdfName.DEVICECMYK.equals(colorspace)) {
}
else if (colorspace instanceof PdfArray) {
PdfArray ca = (PdfArray)colorspace;
PdfObject tyca = ca.getDirectObject(0);
if (!PdfName.ICCBASED.equals(tyca))
throw new UnsupportedPdfException(MessageLocalization.getComposedMessage("the.color.space.1.is.not.supported", colorspace));
PRStream pr = (PRStream)ca.getDirectObject(1);
int n = pr.getAsNumber(PdfName.N).intValue();
if (n != 4) {
throw new UnsupportedPdfException(MessageLocalization.getComposedMessage("N.value.1.is.not.supported", n));
}
icc = PdfReader.getStreamBytes(pr);