Bug 47151 - [PATCH] ImageManager.getImageInfo returns incorrect image size due multiple unit conversions in ImageIOUtil.extractResolution
Summary: [PATCH] ImageManager.getImageInfo returns incorrect image size due multiple u...
Status: RESOLVED WONTFIX
Alias: None
Product: XMLGraphicsCommons - Now in Jira
Classification: Unclassified
Component: utilities (show other bugs)
Version: 1.3.1
Hardware: All All
: P2 normal (vote)
Target Milestone: --
Assignee: XML Graphics Project Mailing List
URL:
Keywords:
Depends on:
Blocks: 47157
  Show dependency tree
 
Reported: 2009-05-04 14:36 UTC by David Green
Modified: 2010-09-09 08:55 UTC (History)
0 users



Attachments
candidate fix (1.54 KB, patch)
2009-05-04 15:15 UTC, David Green
Details | Diff
mylyn/context/zip (16.86 KB, application/octet-stream)
2009-05-04 15:16 UTC, David Green
Details
updated patch with JUnit test (3.34 KB, patch)
2009-05-06 09:00 UTC, David Green
Details | Diff
mylyn/context/zip (32.49 KB, application/octet-stream)
2009-05-06 09:00 UTC, David Green
Details
image used in JUnit (21.48 KB, image/png)
2009-05-06 09:01 UTC, David Green
Details
Image test file (91.79 KB, image/jpeg)
2010-05-27 03:19 UTC, Nicolas
Details
PDF output (89.29 KB, application/pdf)
2010-05-27 03:20 UTC, Nicolas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Green 2009-05-04 14:36:43 UTC
PreloaderImageIO is used by ImageManager to get image information, including size (height and width) and DPI. Unfortunately ImageIOUtil.extractResolution() causes image sizes to be incorrect in some cases due to multiple floating point operations.  This results in FOP rendering blurry images when creating PDFs.
Comment 1 David Green 2009-05-04 15:15:13 UTC
Created attachment 23609 [details]
candidate fix

attached a candidate fix that eliminates a computation that causes loss of precision
Comment 2 David Green 2009-05-04 15:16:08 UTC
Created attachment 23610 [details]
mylyn/context/zip
Comment 3 Chris Bowditch 2009-05-06 00:49:20 UTC
Thanks for the patch. Would you mind also attaching a sample Image that demonstrates the issue you reported. Thanks!
Comment 4 David Green 2009-05-06 09:00:26 UTC
Created attachment 23618 [details]
updated patch with JUnit test
Comment 5 David Green 2009-05-06 09:00:31 UTC
Created attachment 23619 [details]
mylyn/context/zip
Comment 6 David Green 2009-05-06 09:01:06 UTC
Created attachment 23620 [details]
image used in JUnit
Comment 7 Jeremias Maerki 2010-03-18 09:27:35 UTC
I've taken a look at this patch but I fail to see the difference before and after the patch (with David's PNG file). I know this "blur" issue has been reported more than once, but so far I cannot reproduce it. Can anyone provide screenshots and PDFs that demonstrate the issue?
Comment 8 Nicolas 2010-05-27 03:19:11 UTC
Created attachment 25487 [details]
Image test file

The patch did not work for me. Here is the image I have been using.
Comment 9 Nicolas 2010-05-27 03:20:36 UTC
Created attachment 25488 [details]
PDF output

And that one is the pdf output.
Comment 10 Jeremias Maerki 2010-05-30 10:24:35 UTC
(In reply to comment #8)
> Created an attachment (id=25487) [details]
> Image test file
> 
> The patch did not work for me. Here is the image I have been using.

Hmm, so far the images presented here are all blurry to begin with. That's an effect from anti-aliasing. What I'm still missing is a screenshot that demonstrates that a (sharp) image embedded in a PDF is displayed in a blurry fashion.
Comment 11 Nicolas 2010-05-31 03:06:24 UTC
(In reply to comment #10)
> (In reply to comment #8)
> > Created an attachment (id=25487) [details] [details]
> > Image test file
> > 
> > The patch did not work for me. Here is the image I have been using.
> 
> Hmm, so far the images presented here are all blurry to begin with. That's an
> effect from anti-aliasing. What I'm still missing is a screenshot that
> demonstrates that a (sharp) image embedded in a PDF is displayed in a blurry
> fashion.

Seems you are right. Those images were generated using Microsoft Visio. I created some basic images using Gimp, got some more from internet, and they render much better.
Comment 12 Jeremias Maerki 2010-09-09 08:55:27 UTC
I'm closing this issue due to lack of evidence that this patch solves anything. I'm still not convinced we have a problem here. Please reopen if anyone has a good test case.