not sure abohttp://www.imagemagick.org/script/api.php#javaut the java implementation but imagemagix C/C++ are good.
On Thu, Apr 16, 2009 at 2:23 AM, Jeremias Maerki <d...@jeremias-maerki.ch>wrote: > Daniel, I think there's a misunderstanding. PDF doesn't contain TIFF > files. And not PNGs. In a way you could say PDFs can contain JPEGs as > the DCTDecode filter handles practically the same as a raw JPEG file. In > FOP we can basically embed a baseline JPEG file 1:1 without > decompression in a PDF. But the same is not true for TIFF and PNG. What > PDF uses are the PNG predictors to increase image compression over plain > deflate. But that's not the same as PNG. I've tried to embed PNGs in > PDFs without decompressing them in FOP and I didn't manage for some > reason. > > By transparent TIFF, you mean black/white 1bit images. Is that right? > When you're talking about TIFF, are you not rather talking about the > CCITTFaxDecode filter which uses the compression algorithms defined in > the ITU T.4 and T.6 specifications (CCITT Fax Group 3 and 4)? Like PDF, > TIFF uses those algorithms, but that's not the same as embedding TIFF. > In FOP, we can transfer CCITT encoded image data extracted from TIFF > into PDFs without decompression, much like JPEG data. > > I've just had a closer look at CCITTFaxDecodeFilter in PDFBox. If I > interpret the code correctly, it actually just embeds the stream data in > a TIFF wrapper which is loaded (now by ImageIO?) somewhere else. Not > what I expected. This was probably a work-around to make use of JAI's > codec for this kind of image. I guess what you're really looking for is > a decompressor (and eventually a compressor) for ITU T.4 and T.6. > > A suitably licensed decompressor can be found in Apache XML Graphics > Commons: > > http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java?view=markup > > This could be integrated into an implementation of the CCITTFaxDecode > filter in PDFBox. > > For the compression side, I'm currently working on a T.4/T.6 compressor > but that's not finished, yet. I need that for FOP's PDF, PS, AFP and > TIFF output. I'm implementing it as an OutputStream subclass so it can > easily be integrated in Sanselan, PDFBox or whatever. The only two > problems left is finding the right place to put it in the end and for me > to find time to finish it. > > BTW, Sanselan doesn't have a CCITT/T.4/T.6 implementation, yet, so it > won't be a help right now. > > So if I got this right, a full TIFF codec is only needed if you wanted > PDFBox to be able to read TIFFs when embedding them in a new PDF or when > you extract bitmaps from a PDF and want to save them as external image > files. For PDF viewing, you only need the T.4/T.6 decompressor. > > I hope I'm making sense. > > On 15.04.2009 21:52:25 Daniel Wilson wrote: > > Some PDF's have transparent TIFF's in them. > > > > They come into the PDXObject arena ... as a PDPixelMap. But there we are > > best prepared to handle JPEG's and PNG's. > > > > Most sources on rendering a TIFF in Java say to use JAI. Someone (Jukka > I > > think) went to a good deal of trouble to excise JAI from PDFBox due to > > licensing restrictions. > > > > Lizardworks' TIFF library is about 10 years old, lacks Deflate > > decompression, and is licensed under the Library GPL. > > http://www.lizardworks.com/libs.html > > > > So I don't think it is an option. > > > > The TIFF spec is 121 pages long in its own right. > > http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf > > That's a lot simpler than PDF, but doing our own implementation would be > a > > non-trivial undertaking. > > > > Any ideas on how to procede? > > > > Thanks. > > > > Daniel Wilson > > > > > Jeremias Maerki > >