You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Peter <pc...@gmail.com> on 2006/09/21 16:23:32 UTC

Quality of included image degrades when png rendering is used

Gentlepeople,

 

Using fop trunk.

 

When I include an image using external-graphic (tried both jpeg and gif) the
image displays just fine when rendering to pdf. When rendering to png
however the image looks much worse (not sure how to describe it, it looses
contrast or something like that).

 

When I do the exact same thing but use batik to include the image it looks
just fine.

 

Anyone any thoughts on this? 

 

Thanks,

 

Peter

 

PS  Here is an example 

 

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="master" page-height="200pt"
page-width="200pt">
          <fo:region-body/>
        </fo:simple-page-master>
    </fo:layout-master-set>

    <fo:page-sequence master-reference="master">
        <fo:flow flow-name="xsl-region-body">
            <fo:block-container absolute-position="fixed" left="10pt"
top="10pt" width="40pt" height="20pt">
                <fo:block linefeed-treatment="ignore" font-size="0">
                    <fo:instream-foreign-object width="40pt" height="20pt">
                        <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
width="40" height="20">
                            <svg:image
xmlns:xlink="http://www.w3.org/1999/xlink" 
                                       width="40"
                                       height="20" 
                                       preserveAspectRatio="none" 
 
xlink:href="http://xmlgraphics.apache.org/images/apache-xml-graphics.gif" 
 
xmlns:svg="http://www.w3.org/2000/svg"/>
                        </svg:svg>
                    </fo:instream-foreign-object>
                </fo:block>
            </fo:block-container>


            <fo:block-container absolute-position="fixed" left="10pt"
top="50pt" width="40pt" height="20pt">
                <fo:block linefeed-treatment="ignore" font-size="0">
                    <fo:external-graphic 
                      scaling="non-uniform" 
 
src="url(http://xmlgraphics.apache.org/images/apache-xml-graphics.gif)" 
                      content-width="scale-to-fit" 
                      width="40pt" 
                      content-height="scale-to-fit" 
                      height="20pt"/>
                </fo:block>
            </fo:block-container>
        </fo:flow>
    </fo:page-sequence>
</fo:root> 

 

 

 


RE: Quality of included image degrades when png rendering is used

Posted by Peter <pc...@gmail.com>.
 
> You mean the image from the external-graphic is lighter than the one
> painted through SVG/Batik when you render the attached FO file to PNG
> instead of PDF?
That is indeed what I refer to
 
> This has something to do with color management which is something I've
> only started to understand. Bitmap image handling is optimized for PDF
> (using decoded byte arrays instead of RenderedImage/BufferedImage for
> bitmaps) and this is probably the first time we see the side-effect of
> this. It's line 953 in Java2DRenderer where CS_LINEAR_RGB is used
> instead of CS_sRGB. But just setting this to CS_sRGB is possibly wrong
> in other cases. That's why I think the org.apache.fop.image package
> needs to be refactored to use RenderedImage/BufferedImage.

I tried it and it indeed fixes the reported issue

> I will likely work on this in the next three months. But help is welcome,
> of course.
> 
I do need an xsl/svg implementation that has color management right or at
least "good enough". This includes cmyk support (see another post on the dev
list). For now I would prefer to continue using fop and help where possible
to get the fop support better. That is, assuming the effort involved is
"acceptable", something which is difficult for me to judge at this stage.




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


Re: Quality of included image degrades when png rendering is used

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
You mean the image from the external-graphic is lighter than the one
painted through SVG/Batik when you render the attached FO file to PNG
instead of PDF?

This has something to do with color management which is something I've
only started to understand. Bitmap image handling is optimized for PDF
(using decoded byte arrays instead of RenderedImage/BufferedImage for
bitmaps) and this is probably the first time we see the side-effect of
this. It's line 953 in Java2DRenderer where CS_LINEAR_RGB is used
instead of CS_sRGB. But just setting this to CS_sRGB is possibly wrong
in other cases. That's why I think the org.apache.fop.image package
needs to be refactored to use RenderedImage/BufferedImage.

The reason why the SVG/Batik-controlled image is appearing correctly:
Batik internally works properly with the AWT image infrastructure and
therefore preserves color space information which we currently don't in
FOP.

I will likely work on this in the next three months. But help is welcome,
of course.

On 21.09.2006 16:23:32 Peter wrote:
> Gentlepeople,
>  
> Using fop trunk.
>  
> When I include an image using external-graphic (tried both jpeg and gif) the
> image displays just fine when rendering to pdf. When rendering to png
> however the image looks much worse (not sure how to describe it, it looses
> contrast or something like that).
>  
> When I do the exact same thing but use batik to include the image it looks
> just fine.
>  
> Anyone any thoughts on this? 
>  
> Thanks,
>  
> Peter
>  
> PS  Here is an example 
<snip/>

Jeremias Maerki


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


Re: Quality of included image degrades when png rendering is used

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

I'm afraid that this issue still remain open.
Note that now our issue database is on Jira:

https://issues.apache.org/jira/browse/FOP-1663


2014-06-05 13:26 GMT+02:00 rushabh <ru...@igate.com>:
> Hi ,
>
>
> Can anyone tell me that wheather this issue with PNG, is solved or not .??
>
> I think some one has raised a bug id - 47157 regarding this to you .. So is
> it solved or not ?? Because i am facing the same problem with Rendering PNG
> files in PDF ..
>
>
>
> Thanks,
> Rushabh Ajmera
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Quality-of-included-image-degrades-when-png-rendering-is-used-tp5702p40755.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>



-- 
pascal

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


Re: Quality of included image degrades when png rendering is used

Posted by rushabh <ru...@igate.com>.
Hi ,


Can anyone tell me that wheather this issue with PNG, is solved or not .??

I think some one has raised a bug id - 47157 regarding this to you .. So is
it solved or not ?? Because i am facing the same problem with Rendering PNG
files in PDF ..



Thanks,
Rushabh Ajmera



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Quality-of-included-image-degrades-when-png-rendering-is-used-tp5702p40755.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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