voyent
No colour in MultiPageCapture output  XML
Forum Index -> ICEpdf General
Author Message
jjames

Joined: 02/Nov/2016 02:24:34
Messages: 3
Offline


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!
patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


Just did a little digging around and it does appear to be possible even for baseline tiffs.

I'll take a shot at the problem. Do you have any constraints around compression types?
[Email]
patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


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.

CCITT T.4 - 869 KB (reference gray scale capture)
Deflate - 1143 KB
JPEG - 2614 KB
LZW - 1600 KB
Pack Bits - 7555 KB
ZLib - 1143 KB

More info on the compression formats can be found here, http://download.java.net/media/jai-imageio/javadoc/1.1/com/sun/media/imageio/plugins/tiff/TIFFImageWriteParam.html

I suspect this might also be possible with TwelveMonkies but haven't had a chance to try it out.
 Filename MultiPageCapture.java [Disk] Download
 Description
 Filesize 7 Kbytes
 Downloaded:  695 time(s)

[Email]
jjames

Joined: 02/Nov/2016 02:24:34
Messages: 3
Offline


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.
 
Forum Index -> ICEpdf General
Go to:   
Powered by JForum 2.1.7ice © JForum Team