xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Image handling with PDFTranscoder
Date Mon, 15 Sep 2008 10:21:30 GMT
Hi Lars,

"Lars Eirik Rønning" <larseirik@gmail.com> wrote on 09/12/2008 07:45:19 

> I need to be able to produce high res images (300dpi) for my pdf. 
> This works beautifully when working with large images.
> However there is a requirement that all images have to fit a 
> particular rectanglular size (i use preserveSetting="xMidYMid 
> slice") for this. Basically all images have to fit a frame.
> If i add the PDFTranscoderHint Key_resoution(300)) will this try to 
> get the best possible image quality or am I suppose to handle this 
> my self?

   KEY_RESOLUTION tells Batik what resolution it should render
elements that it needs to flatten (for example filters).  I believe
when you draw an image there are two cases.  One is that for at
least JPEG it will embed the JPEG in the PDF document 'as is' (and 
provide a scale as needed).  The other is that Batik will flatten 
the image at 300dpi.

> The latter would require me to calcuate for each image how 
> to find the best quality and set the dpi for each image 
> individually.(that means i would have to do the scaling myself..
> The problem is whenever i have a low res image and need to display 
> this in the big rectangle the image will be small if i do this manually.

   So if you have a low res image that is being displayed in a
large rectangle then it will look bad regardless of who scales
the image. 

   This paragraph makes me think that what you want is for
Batik to calculate how large the frame should be for an image
based on it's physical image size.  This is a pretty simple
        <width in inches> = <image width pixels>/300; // similar for 

   Then you can just set the width/height of the image to that and
Batik will scale appropriately.

   To be honest I'm not sure I really understand what it is you
are looking for.

> I was hoping i would not have to do a lot of calculation to get the 
> best results.
> Thanks guys. 

View raw message