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

[PATCH] Improvements for bitmap production (resolution and color depth)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8.0-incubator
    • 0.8.0-incubator
    • Utilities
    • None

    Description

      The attached patch improves the PDFToImage utility to support a resolution and color depth setting.
      -resolution 300dpi creates a 300 dpi bitmap
      -color rgba creates an RGB 24bit image with an 8bit alpha channel
      -color rgb creates an RGB 24bit image
      -color gray creates an 8bit gray image
      -color indexed creates an 8bit color image with 256 indexed colors (that was what was produced before the change)
      -color bilevel creates a 1bit bi-level image

      The patch also fixes various Checkstyle issues in the classes I touched. I've tried to preserve method backwards-compatibility. However, I've changed PDFImageWriter.WriteImage to PDFImageWriter.writeImage. Method names should always start with a lower-case character. PageDrawer has similar problems which I didn't fix, however.

      @Daniel: Please note that the changes makes the TestPDFToImage test case fail because I've changed the default settings for PDFToImage to "rgb" and the screen resolution (usually 96dpi). Before the settings were equivalent to "-resolution 144 -color indexed". Furthermore, the output formats that support a resolution value through standard ImageIO metadata will now contain the resolution information. That alone will make the reference PNGs different even if I had set the default settings to the old settings and effectively created the same images on the pixel level. You may need to decide on the settings for the test and recreate the reference bitmaps.

      Attachments

        1. bitmap-production-improvements.diff
          38 kB
          Jeremias Maerki

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jeremias@apache.org Jeremias Maerki
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: