Jimmy Merrild Krag created IMAGING-231:
------------------------------------------

             Summary: Reading tiff with LZW compression results in mangled image
                 Key: IMAGING-231
                 URL: https://issues.apache.org/jira/browse/IMAGING-231
             Project: Commons Imaging
          Issue Type: Bug
          Components: Format: TIFF
    Affects Versions: 1.0-alpha1
            Reporter: Jimmy Merrild Krag
         Attachments: image_pages.zip, result.pdf

I am trying to create a PDF using PDFbox with Commons Imaging for loading 
images. Commons imaging fixes most of the issues I have with the alternatives, 
but still cannot load my tiff files correctly.

I have attached a resulting PDF as {{result.pdf}}.

 The files I use for testing, are attached in {{image_pages.zip}}. The 
tiff-files, which are not loaded correctly, are LZW-compressed, and that is the 
only difference I can find in the format.


All images look the same if I save them to separate image files in another 
format, as they do in the PDF, so PDFbox does not seem to be the one to blame. 
My code for reading the files is pretty straightforward:

 
{code:java}
ImageInfo imageInfo = Imaging.getImageInfo(imageBytes);
if (imageInfo.getNumberOfImages() > 1) {

    List<BufferedImage> allBufferedImages = 
Imaging.getAllBufferedImages(imageBytes);

    for (BufferedImage bufferedImage : allBufferedImages) {
        appendImagePage(bufferedImage);
    }

} else {
    appendImagePage(Imaging.getBufferedImage(imageBytes));
}
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to