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 2006/09/06 13:59:11 UTC

DO NOT REPLY [Bug 40425] New: - PNG - Cannot read image dimensions

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40425>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40425

           Summary: PNG - Cannot read image dimensions
           Product: Fop
           Version: 1.0dev
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: images
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: joe-fop@7val.com


<fo:external-graphic width="auto" height="auto" content-width="2cm" 
src="url(image.png)"/>

produces an "Cannot read image dimensions" message and finally results in a 
java.lang.NullPointerException
 at org.apache.fop.image.ImageIOImage.loadBitmap(ImageIOImage.java:86)

I don't know whether this is due to a broken PNG image (See image in 
attachment), but it actually did work in FOP 0.92.

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

DO NOT REPLY [Bug 40425] - PNG - Cannot read image dimensions

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40425>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40425





------- Additional Comments From joe-fop@7val.com  2006-09-06 12:00 -------
Created an attachment (id=18827)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18827&action=view)
PNG image to reproduce the bug


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

DO NOT REPLY [Bug 40425] - PNG - Cannot read image dimensions

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40425>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40425





------- Additional Comments From joe-fop@7val.com  2006-09-07 08:50 -------
Right, running FOP with JDK 1.5 works :-) 

Building and running FOP using JDK 1.4.2_11 with the latest sources form the 
SVN trunk, I get the following backtrace. The build proceeds, though, 
resulting in a PDF document missing that image (which in fact is a black 
square to simplify matters). 

07.09.2006 10:10:09 org.apache.fop.image.ImageIOImage loadBitmap
SCHWERWIEGEND: Error while loading image: 4
java.lang.ArrayIndexOutOfBoundsException: 4
        at 
com.sun.imageio.plugins.png.PNGImageReader.parse_PLTE_chunk(PNGImageReader.java:347)
        at 
com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:635)
        at 
com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1309)
        at 
com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1530)
        at org.apache.fop.image.ImageIOImage.loadBitmap(ImageIOImage.java:96)
        at 
org.apache.fop.image.ImageIOImage.loadDimensions(ImageIOImage.java:66)
        at 
org.apache.fop.image.AbstractFopImage.load(AbstractFopImage.java:160)
        at 
org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:73)
        at org.apache.fop.fo.FObj.processNode(FObj.java:118)
        at 
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:321)
        at 
org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1020)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
Source)
        at 
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:452)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:160)
        at org.apache.fop.cli.Main.main(Main.java:191)
07.09.2006 10:10:09 org.apache.fop.fo.flow.ExternalGraphic bind
SCHWERWIEGEND: Cannot read image dimensions: 
url(/home/joe/docbook/images/caution.png)


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

DO NOT REPLY [Bug 40425] - PNG - Cannot read image dimensions

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40425>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40425





------- Additional Comments From manuel@apache.org  2006-09-06 14:39 -------
Works for me (assuming the image is suppose to be a black 200x200 square). This 
is with the trunk version of FOP under JDK 1.5.x. This means it should be using 
ImageIO in my case.

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

DO NOT REPLY [Bug 40425] - PNG - Cannot read image dimensions

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40425>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40425


jeremias@apache.org changed:

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




------- Additional Comments From jeremias@apache.org  2006-09-10 11:43 -------
Looks like a bug in the PNG codec for JDK 1.4.2_11 then. It may be this bug
here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4826548

As a work-around on JDK 1.4.2, you can change org.apache.fop.image.ImageFactory.
Find the line:
        imt = new ImageMimeType("image/png");

...and change the block there to this:
        imt = new ImageMimeType("image/png");
        imageMimeTypes.put(imt.getMimeType(), imt);
        imt.addProvider(pngImage);
        imt.addProvider(imageIoImage);

This gives the internal PNG codec a higher priority over the ImageIO codec.

(In reply to comment #3)
> Right, running FOP with JDK 1.5 works :-) 
> 
> Building and running FOP using JDK 1.4.2_11 with the latest sources form the 
> SVN trunk, I get the following backtrace. The build proceeds, though, 
> resulting in a PDF document missing that image (which in fact is a black 
> square to simplify matters). 
> 
> 07.09.2006 10:10:09 org.apache.fop.image.ImageIOImage loadBitmap
> SCHWERWIEGEND: Error while loading image: 4
> java.lang.ArrayIndexOutOfBoundsException: 4
>         at 
>
com.sun.imageio.plugins.png.PNGImageReader.parse_PLTE_chunk(PNGImageReader.java:347)

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