Using the example given by ICEpdf for a multiple page PDF conversion to TIFF, I have been unable to produce an output with the same colours as the original - only black and white. I accept I am probably missing something obvious in the code but I'm a Java developer by trade; image conversion algorithms and formats are not something I fully understand, even with the thorough documentation supplied.
I've attempted: changing compression types; adding an alpha map to the IndexColorModel constructor; comparing graphics context's current color between this implementation and the PageCapture class (as that outputs a colour TIFF) and changing the BufferedImage type. Any help would be appreciated even if those ideas seem laughable!
Attached is a modified MultiPageCapture.java that keeps the RGB colour model and saves the TIFF using the Zlib compression. The default example uses CCITT T.4 which is an older B&W Fax format and is why there is all the colour model conversion.
On my system using a two page document I went through the various compression formats that support RGB. Here are my finding with regards to file size.
Many thanks! As noted, I had tried changing the compression types after reading documentation stating the CCITT T.4 format was for black and white faxes. However, this did not resolve the issue and after reading your code it seems the JAI filter settings were impacting the colour conversion as well.
Your supplied code worked for me so it's much appreciated. I can now take a look at the differences between compression types. Thank you again.