I found the source of the problem: the downscaling of an image is done by applying an affine transformation ->line 145 in GraphicUtil: cr = new AffineRed(cr, at, g2d.getRenderingHints());
on a BufferedImage. This results in a scaled raster image. then you take only the visible portion of the scaled image and write out to pdf as an XObject.
(Please tell me if my description of the process is wrong.)
for pdf it is resonable to have another option: the source image is embedded unchanged in the pdf and the affine transfomation is done in the proper pdf page like:
stream
q %Save graphics state
132 0 0 132 45 149 cm %Translate (45, 140) and scale by 132
/Im1 Do %Paint image
Q %Restore graphics state
endstream
By doing this you can embbed hi-resolution images they fit the needs for printing.
The drawback is that the docs can get much bigger, depending on the images used. so maybe there should be an option for "Webdocs" and for "Printdocs"? A new comand line arg?
Actually i read a lot of source code and try to find out how you encode the rasterImage as a stream and XObject and where you embbed the image in a pdf-page.
Ok thats the actual status.
nice weekend (i have to play around with batik of course) roland
On Tue, 10 Jun 2003 12:58:51 -0400, Thomas E Deweese <[EMAIL PROTECTED]> wrote:
"RK" == Roland Kofler <[EMAIL PROTECTED]> writes:
RK> Keiron Liddle suggested to post this issue to batik-dev: I patched RK> the PDFGraphics2D class to get a better resolution for Images. RK> Keiron gave me the hint that i may have to increase the Dimensions RK> of the BufferedImage() to do this. Now, I dont get a better image RK> resolutions, although the file size increases. I think it must be RK> related to the fact that the BufferedImage is downscaled to the RK> documents resolution before (and without the use of an observer RK> for loss-less scaling)
Actually the problem seems to be that the image is _not_ scaled. Towards the end of the drawImage method the PDFGraphics sets up the transform for the image, this needs to take into account the scale factor. Also I noticed at least one place where you only used IMAGE_RESOLUTION_FACTOR when you needed to use IMAGE_RESOLUTION_FACTOR*IMAGE_RESOLUTION_FACTOR (it was calculating the size of the image in pixels).
RK> I'm quiet new to the code, I go ahead and try hard to understand RK> what happens, Any hint is very appreciated!
Unfortuantely I don't have the time to fully investigate this hopefully the above will give you a few new leads to follow.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]