Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1819

Rendering problem with JPX image

    XMLWordPrintableJSON

Details

    Description

      The first page of the file 635312.pdf (of PDFBOX-1812) isn't rendered correctly. It is made of three JPX images where the colorspace is in the PDF. (My understanding of the PDF spec is that the values mentioned in the PDF have a higher priority) The first problem is that BITS_PER_COMPONENT is currently set in JPXFilter based on the image colorspace (that we don't want), and it results in a wrong bpc calculation of 8 / 3 = 2. This results in an array difference for System.arraycopy() in PDPixelmap.

      So the solution is to move that part into the "if" branch, i.e. calculate bpc only if the colorspace isn't already set. (Alternatively, calculate it only if bpc isn't already set)

      The images are now rendered correctly re: the shapes, but not re: the colors, which is the second problem (and where I give up for now). Only the black pixels seem to be correct, but not most of the grey ones except the ones in top of the sky.

      Attachments

        1. 635312.pdf
          8.82 MB
          Tilman Hausherr
        2. 635312.pdf-1-lessbad.png
          2.22 MB
          Tilman Hausherr
        3. 635312.pdf-1-verybad.png
          839 kB
          Tilman Hausherr
        4. 635312-image2.jp2
          654 kB
          Tilman Hausherr

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tilman Tilman Hausherr
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: