Fop
  1. Fop
  2. FOP-1362

[PATCH] The source-resolution configuration option is not honored

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 0.93
    • Fix Version/s: None
    • Component/s: image/unqualified
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: All
    • External issue ID:
      42406

      Description

      The source-resolution configuration option is not honored by FOP 0.93. Hence,
      the default resolution of a bitmap image is hardwired to 72DPI, which is way too
      big (XSL seems to say 90DPI, RenderX XEP uses 120DPI).

      Of course, there is workaround which consists in specifying the size of the
      image in inches or in centimeters. But this workaround is not as handy as
      specifying a proper source-resolution.

      I've made some very straightforward changes to
      src/java/org/apache/fop/image/analyser/BMPReader.java, GIFReader.java,
      JPEGReader.java, PNGReader.java, TIFFReader.java to make FOP honor the
      source-resolution configuration option.

      In all .java files, the changes always look like this:

      [1] Replace the definition of getDimension():

      ---------------------------------------------------------------
      private FopImage.ImageInfo getDimension(byte[] header) {
      FopImage.ImageInfo info = new FopImage.ImageInfo();
      ...
      return info;
      }
      ---------------------------------------------------------------

      by:

      ---------------------------------------------------------------
      private void getDimension(byte[] header, FopImage.ImageInfo info) {
      ...
      }
      ---------------------------------------------------------------

      [2] Replace the invokation of getDimension():

      ---------------------------------------------------------------
      FopImage.ImageInfo info = getDimension(header);
      ---------------------------------------------------------------

      by:

      ---------------------------------------------------------------
      FopImage.ImageInfo info = new FopImage.ImageInfo();
      info.dpiHorizontal = ua.getFactory().getSourceResolution();
      info.dpiVertical = info.dpiHorizontal;

      getDimension(header, info);
      ---------------------------------------------------------------

      If you want a real patch, just send me an email saying so.

        Activity

        Hide
        Glenn Adams added a comment -

        batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed

        Show
        Glenn Adams added a comment - batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed
        Hide
        Jeremias Maerki added a comment -

        Patch applied. Thanks a lot, Hussein.
        http://svn.apache.org/viewvc?view=rev&rev=540052

        Show
        Jeremias Maerki added a comment - Patch applied. Thanks a lot, Hussein. http://svn.apache.org/viewvc?view=rev&rev=540052
        Hide
        Chris Bowditch added a comment -

        Thanks!

        Show
        Chris Bowditch added a comment - Thanks!
        Hide
        Hussein Shafie added a comment -

        Attachment patch_fop_image_analyser.diff has been added with description: Patch for FOP 0.93 src/java/org/apache/fop/image/analyser/ directory

        Show
        Hussein Shafie added a comment - Attachment patch_fop_image_analyser.diff has been added with description: Patch for FOP 0.93 src/java/org/apache/fop/image/analyser/ directory
        Hide
        Hussein Shafie added a comment -

        This patch (generated using svn diff as explained on your site) will patch
        src/java/org/apache/fop/image/analyser/BMPReader.java, GIFReader.java,
        JPEGReader.java, PNGReader.java, TIFFReader.java to make these classes honor
        the source-resolution configuration option.

        Show
        Hussein Shafie added a comment - This patch (generated using svn diff as explained on your site) will patch src/java/org/apache/fop/image/analyser/BMPReader.java, GIFReader.java, JPEGReader.java, PNGReader.java, TIFFReader.java to make these classes honor the source-resolution configuration option.
        Hide
        Chris Bowditch added a comment -

        Thanks for the observation. Please can you attach a Patch file to this bug
        report. Thanks!

        Show
        Chris Bowditch added a comment - Thanks for the observation. Please can you attach a Patch file to this bug report. Thanks!

          People

          • Assignee:
            fop-dev
            Reporter:
            Hussein Shafie
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development