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 Jay Chiu <ja...@ureach.com> on 2004/02/12 05:02:59 UTC

Re: Re: Problem with scaling png image file in svg

Chris and Thomas,

Can you please give me some help? Please tell me which files I
should change to solve the problem.

Thanks a lot.

Jay


============================================

List:       fop-user
Subject:    Re: Re: Problem with scaling png image file in svg
From:       Jay Chiu <jaychiu () ureach ! com>
Date:       2004-02-10 5:13:26

I think changing org.apache.fop.svg.PDFGraphics2D class may
solve the image quality issue. Because PDFGraphics2D class
hangles the image drawing. Can Fop developer please give me
some
help?

I tried to debug through fop with batik and find the call stack
for handling my png image is as following:

(1)org.apache.fop.svg.PDFGraphics2D.drawImage(Image img, int x,
int y,ImageObserver observer)
(2)org.apache.batik.ext.awt.image.GraphicsUtil.drawImag(Graphics2D
g2d, CachableRed cr):152
(3)org.apache.batik.ext.awt.image.GraphicsUtil.drawImag(Graphics2D
g2d, CachableRed cr):439
(4)org.apache.batik.gvt.primitivePaint(Graphics2D g2d):92
(5)org.apache.batik.gv.AbstractGraphicsNode.paint(Graphics2D
g2d):485
(6)org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Graphics2D
g2d):130
(7)org.apache.batik.gv.AbstractGraphicsNode.paint(Graphics2D
g2d):485
(8)org.apache.batik.gvt.ImageNode.paint(Graphics2D g2d):34
org.apache.batik.gv.AbstractGraphicsNode.paint(Graphics2D g2d)

>From the call stack info, it is clear that PDFGraphics2D
handles
the actual external image drawing. Can someone change
PDFGraphics2d to use the same approach to handle external image
file as other image handling code in FOP does?

Thanks.

Jay

> ---- On Sat, 07 Feb 2004, Jay Chiu (jaychiu@ureach.com)
wrote:
> 
> Thanks Thomas,
>  
> I guess anyone who includes images in SVG may get the same
> problem. 
> 
> We are delivering a report tool to client and the client is
> complaining about the chart quality in pdf. Thus we are in a
> hurry to solve this isse. 
> 
> If someone has already written some code to solve this issue,
> please forward me some of your code.
> 
> If it is not too difficult, can you please give me some hint
and
> tell me which file should be changed? I guess probably we may
> take some fop's code to solve this issue, becuase the
> subsampling works fine in Fop.
> 
> Thanks a lot.
>  
> Jay
> 
> > ==============================================
> > Subject: Re: Problem with scaling png image file in svg 
> > From: Thomas DeWeese <Th...@Kodak.com> 
> > Date: Fri, 06 Feb 2004 06:25:45 -0500 
> > To: batik-dev@xml.apache.org 
> > 
> >
>
--------------------------------------------------------------------------------
> > 
> > Jay Chiu wrote:
> > 
> > > I tried with Batik Squiggle for the png images. If I does
> not
> > > use <g transform="scale(xxx)">, the png image looks good
in
> > the
> > > GUI, it does get scaled properly. But image with scale()
> > > transform attribute losses quality, and the png file
> > generated
> > > by Squiggle is in bad quality. 
> > 
> >     The problem is that you are asking to subsample the
image
> > too much.  The large image is reduced by 5x the small by
10x.
> > Batik does not prefilter for large subsample values so you
> > 'loose' pixels with subsample values this high and the
result
> > is aliasing effects.
> > 
> >     If anyone wants to write/contribute a block average or
> > better
> > a true prefiltered resample operation I'm sure it would be
> > appreciated.  I can help with plugging it into Batik in the
> > right spot.
> > 
> > > I am also sending the email to batik-user mail list. Hope
> > Batik
> > > team can also help.
> > > 
> > > Attache please find a svg file , a source png file and
> > > generated
> > > png file.
> > > 
> > > Thanks a lot.
> > > 
> > > Jay
> > > 
> > 
> > 
> > 
> > ________________________________________________
> > Get your own "800" number
> > Voicemail, fax, email, and a lot more
> > http://www.ureach.com/reg/tag
> > 
> > 
> 
> 
> 


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

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


Re: Problem with scaling png image file in svg

Posted by Chris Bowditch <bo...@hotmail.com>.
Jay Chiu wrote:

> Chris and Thomas,
> 
> Can you please give me some help? Please tell me which files I
> should change to solve the problem.

I have run your sample, and the PNG files referenced by 
fo:external-graphic are indeed much better quaility than those embedded 
in SVG using svg:image. I then tried running FOP using -awt option 
instead of generating a PDF and found that the quality of the PNG files 
in fo:external-graphic are bad. That is because the AWT renderer 
probably uses the PDFGraphics2D.drawImage method that you mention.

I only saw part of Thomas's response, in which he seems to be implying 
that the problem is in Batik, but it does seem that there are 
defficiencies in FOP's image handling algorithms. I believe the images 
look okay in the PDF Renderer because responsibility for actually 
rendering the image is passed to acrobat reader. FOP just inserts the 
image into the PDF. I dont know if theres a way to tell the PDF 
transcoder to do the same.

Perhaps one of the more experienced committers can shed some more light 
on this matter.

Chris




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