Bug 42406 - [PATCH] The source-resolution configuration option is not honored
Summary: [PATCH] The source-resolution configuration option is not honored
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: 0.93
Hardware: All other
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-14 04:50 UTC by Hussein Shafie
Modified: 2012-04-01 07:05 UTC (History)
0 users



Attachments
Patch for FOP 0.93 src/java/org/apache/fop/image/analyser/ directory (7.60 KB, patch)
2007-05-14 07:16 UTC, Hussein Shafie
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hussein Shafie 2007-05-14 04:50:01 UTC
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.
Comment 1 Chris Bowditch 2007-05-14 06:11:05 UTC
Thanks for the observation. Please can you attach a Patch file to this bug 
report. Thanks!
Comment 2 Hussein Shafie 2007-05-14 07:16:54 UTC
Created attachment 20193 [details]
Patch for FOP 0.93 src/java/org/apache/fop/image/analyser/ directory

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.
Comment 3 Chris Bowditch 2007-05-14 07:32:12 UTC
Thanks!
Comment 4 Jeremias Maerki 2007-05-21 01:01:03 UTC
Patch applied. Thanks a lot, Hussein.
http://svn.apache.org/viewvc?view=rev&rev=540052
Comment 5 Glenn Adams 2012-04-01 07:05:47 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed