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

Reduce im memory buffers when creating grayscale images

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.11
    • Fix Version/s: None
    • Component/s: PDModel
    • Labels:

      Description

      LosslessFactory uses ByteArrayOutputStreams when creating PDF image data. First, it creates a BAOS in which to store the data, then a BAOS in which to store the flate encoded data. Finally the flate encoded data is written to the PDImageXObject's stream.

      We could instead create an empty PDStream, give it a filter, and write the image data directly into the stream. We then instantiate a PDImageXObject giving it the already created stream.

      This would dramatically reduce RAM requirement if a scratchfile is in play.

        Attachments

        1. PDFBOX-4300-1.patch
          3 kB
          Jesse Long

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jesselong Jesse Long
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: