You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2008/09/18 18:39:22 UTC

DO NOT REPLY [Bug 45835] New: fop massively scales up some jpeg images in pdfs

https://issues.apache.org/bugzilla/show_bug.cgi?id=45835

           Summary: fop massively scales up some jpeg images in pdfs
           Product: Fop
           Version: 0.95
          Platform: PC
               URL: https://bugzilla.redhat.com/show_bug.cgi?id=461915
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: pdf
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: langel@redhat.com


Description of problem:

When using fop to create a PDF document from DocBook XML, some (but not most)
JPEG images are scaled up instead of being shown at 100%. In this test case,
this results in only a small part of the image being shown on the page.

This image was created from a .png (which had transparency, I think, in case
that is interesting), with imagemagick's convert command, and then scaled down
with imagemagick's "mogrify --resize 450x450" command. It seems to be that
resizing that made an image that causes problems for fop, though fop has no
problem with other images that were processed in the same way.

Other applications, such as eog, have no problem with this file.

(I did the conversion to JPEG because of bug #461740, and I did the resizing
because I see no other way to tell fop, or the DocBook XSL, to fit the images
on the page without cropping.)


Steps to Reproduce:

1. Unpack this tarball:
http://www.murrayc.com/temp/docbook_fop_jpeg_test.tar.gz
(I would attach it but that does not work in this bugzilla for tarballs.)

2. cd into the directory

3. Do:
xsltproc -o flumotion.fo -xinclude --catalogs
http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl flumotion.xml 

4: Do:
fop -fo flumotion.fo -pdf flumotion.pdf

The tarballs contains the generated PDF so you can see the result without even
doing that.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835


Lillian Angel <la...@redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |ASSIGNED




--- Comment #4 from Lillian Angel <la...@redhat.com>  2008-09-18 10:41:15 PST ---
I attached the fo-result. Is there a problem with it?

thanks for the description. I will pass this on to the reporter.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835


Jeremias Maerki <je...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #7 from Jeremias Maerki <je...@apache.org>  2008-09-19 00:17:01 PST ---
Looks like I introduced that bug back in 2005 when I added support for reading
the resolution in a JPEG file:
https://svn.apache.org/viewvc?view=rev&revision=198294

And then, this migrated over into the new image loading framework. But it is
fixed now:
http://svn.apache.org/viewvc?rev=696949&view=rev

Thanks for the detailed error report!


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835





--- Comment #2 from Lillian Angel <la...@redhat.com>  2008-09-18 10:38:04 PST ---
Created an attachment (id=22602)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22602)
fo-result


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835


Jeremias Maerki <je...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|images                      |Image codecs
            Product|Fop                         |XMLGraphicsCommons
   Target Milestone|---                         |--
            Version|0.95                        |1.3.1




--- Comment #6 from Jeremias Maerki <je...@apache.org>  2008-09-19 00:09:20 PST ---
This is indeed a problem in XML Graphics Commons but it was transported over
from FOP when the image loading framework was extracted from the old image
loading code in FOP. I already have a fix. Will commit shortly.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835


Andreas L. Delmelle <ad...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|pdf                         |images
         OS/Version|Linux                       |All
           Platform|PC                          |All




--- Comment #5 from Andreas L. Delmelle <ad...@apache.org>  2008-09-18 13:44:35 PST ---

Thanks for the attachments. This seems a bit weird indeed. With all values set
to "auto", FOP has no reason to scale the image at all...

Just confirmed with FOP Trunk on Mac. The JPEG reports a size of 198x450 pixels
at 88,9 dots-per-inch in Preview. A quick debug session shows that XML
Graphics' ImageInfo also reports this height/width in pixels, but... with an
apparent resolution of 13.7795dpi (misread somehow?), which makes the image
about 14.37in high (= 1034.578pt = (198px/13.7795dpi) * 72dpi).

FOP itself is not at fault here... Seems like an issue in XMLGraphics Commons.
Anyone?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835


Jeremias Maerki <je...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fop-
                   |                            |dev@xmlgraphics.apache.org
         AssignedTo|fop-                        |general@xmlgraphics.apache.o
                   |dev@xmlgraphics.apache.org  |rg
             Status|ASSIGNED                    |NEW




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835


Andreas L. Delmelle <ad...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #1 from Andreas L. Delmelle <ad...@apache.org>  2008-09-18 10:01:22 PST ---

It's always helpful (or: more convenient for us) to simply attach the
FO-result. From that, even when we don't have the images, most fop-devs can
immediately see possible causes for your issue.

I suggest you look at any content-height/content-width properties specified on
the external-graphics. If they are set to 'scale-to-fit', then a smaller JPEG
will always be blown up until it fits exactly in the viewport (determined by
width/height specified on the fo:external-graphic)

How to customize Docbook to make sure content-height/content-width are set to
'scale-down-to-fit' (XSL 1.1; should work with FOP Trunk, maybe not yet in
0.95), is something I personally cannot help you with, unfortunately. In your
description, it seems like that is exactly what you need: if the image is
larger, then shrink it, otherwise maintain its intrinsic dimensions.

If you only need the larger images to be clipped, then setting
overflow="hidden" on the external-graphic would be enough (no scaling needed).

Can you let us know if this helped? Seems like it's not a bug, but simply
compliant behavior.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45835] fop massively scales up some jpeg images in pdfs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45835





--- Comment #3 from Lillian Angel <la...@redhat.com>  2008-09-18 10:38:15 PST ---
Created an attachment (id=22603)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22603)
pdf created


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.