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

Allow subsampled/downscaled rendering of images, and rendering subimages

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.8
    • 2.0.9, 3.0.0 PDFBox
    • Rendering
    • None
    • Patch

    Description

      Suggested/contributed change to allow subsampling of images and rendering sub-regions of images.  

      The need arises from having very large images which are highly compressed (usually JPEG or JBIG2). The current implementation decodes the entire image into memory at full resolution, even if rendering is done at a much lower resolution. 

      Since the change required augmenting the way Filters work (to allow partial/subsampled decoding), it also includes a partial fix for PDFBOX-3340.  

       

      This change introduces "DecodeOptions" which are currently only applicable for images. They include requesting only metadata (for PDImageXObject's repair method), subsampling and sub-region (similar to javax.imagio.ImageReadParam). 

      Since not all filters can or do honor (use) the options, the DecodeOptions class contains a flag. Filters that honor the options (subsample / decode only requested region) set it to true. If the flag is false, the subsampling or cropping should be done after decoding, to ensure consistency. 

      PageDrawer was modified so it uses subsampling based on the ratio of the desired output to the original image. 

       

      Attachments

        1. image_rendering_subsampling_hack.patch
          65 kB
          Itai Shaked
        2. 0001-Image-render-subsample.patch
          49 kB
          Itai Shaked
        3. 067445.pdf
          461 kB
          Tilman Hausherr
        4. large-jpeg.pdf
          5.09 MB
          Itai Shaked
        5. 0001-Image-rendering-subsampling-removed-metadata-options.patch
          51 kB
          Itai Shaked
        6. PDFBOX-1841.pdf
          411 kB
          Tilman Hausherr
        7. PDFJS-4575-noimagedim.pdf
          0.8 kB
          Tilman Hausherr
        8. 0001-Image-subsampling-revision-2.patch
          11 kB
          Itai Shaked

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              itai Itai Shaked
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: