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

Optimize SampledImageReader.getStencilImage()

    XMLWordPrintableJSON

Details

    Description

      I have a PDF file (which I can't share, it is p182 of the one from https://stackoverflow.com/questions/43248021/pdfbox-2-unusual-memory-consumption ) that needs over 3GB for rendering due to two stencil images that are 18694 x 13214. PDFBox converts stencil images to RGB images, where 1 pixel needs 4 bytes, so such an image uses 1GB.
      After many dead ends over the easter weekend, I realized today that the BufferedImage isn't needed at all - we can process the bits directly.

      Memory footprint is down from 3.6GB to 2.2GB and it is faster too.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: