Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-231

Reading tiff with LZW compression results in mangled image

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0-alpha1
    • None
    • Format: TIFF
    • None

    Description

      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:

       

      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));
      }
      

       

      Attachments

        1. image_pages.zip
          172 kB
          Jimmy Merrild Krag
        2. result.pdf
          232 kB
          Jimmy Merrild Krag

        Activity

          People

            Unassigned Unassigned
            beruic Jimmy Merrild Krag
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: