xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luis Bernardo (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (XGC-99) PNGFile.getImageRawPNG() returns broken image data
Date Thu, 30 Jul 2015 16:49:05 GMT

    [ https://issues.apache.org/jira/browse/XGC-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14647923#comment-14647923

Luis Bernardo commented on XGC-99:

Is the image valid? Can you provide it? And are using the RawPNG image loader with RTF? I
think there are only image handlers for that image loader for PDF and PostScript output.

> PNGFile.getImageRawPNG() returns broken image data
> --------------------------------------------------
>                 Key: XGC-99
>                 URL: https://issues.apache.org/jira/browse/XGC-99
>             Project: XMLGraphicsCommons
>          Issue Type: Bug
>          Components: image codecs
>    Affects Versions: 2.0.1, trunk
>            Reporter: Carsten Pfeiffer
> The ImageRawPNG returned by PNGFile.getImageRawPNG() is broken because the provided InputStream
(streamVec) contains only part of the raw image data. For a start the magic header is missing,
but it's not enough to add it.
> To fix this, I copied the entire stream in the PNGFile constructor like this:
> {code}
>         stream.mark(Integer.MAX_VALUE);
>         ByteArrayOutputStream out = new ByteArrayOutputStream();
>         IOUtils.copy(stream, out);
>         rawStream = new ByteArrayInputStream(out.toByteArray());
>         out = null;
>         stream.reset();
> {code}
> and use the rawStream in favor of streamVec, which can be removed then.
> Testcases still run successful. This fixes RTF output not working with PNG files in FOP
because it checks for (missing) the PNG magic header.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org

View raw message