I am just getting started with both SVG manipulation and Batik, mostly
relevant to what you're doing however. We are starting to be supplied
SVG images, in fairly large numbers, for the publications we produce;
but we need raster for our layout/composition engine.
Since SVG is more or less device independent, it's confusing as to how
to "scale up" the SVG in memory before a conversion to raster. With one
set of files, I found that I had to do some manipulation of some
attributes to make them "larger" in memory for batik-rasterizer. For
example, one set of files had size attributes like this:
<svg viewBox="2.145927 -6.520668 1.79657 1.452484" width="100%"
height="100%" ... >
I don't know what application wrote these, but those unqualified values
default to pixels according to SVG standard as I understand it (maybe
the controlling application has "preference settings" to interpret these
as inches, which they obviously are intended to be). But without that
application, they are just px to Batik. So I wrote some basic perl to
convert the above to:
<svg viewBox="2.145927 -6.520668 1.79657 1.452484" width="1.79657in"
height="1.452484in" ... >
As I understand it, the unit of measure used on the "width" and "height"
properties on the root svg element is inherited as the default unit of
measure by the rest of the svg. So specifying the unit of measure here
is very powerful and appears to be all I had to do to the whole file.
After doing this, my results from batik-rasterizer were much better. I
realize this is not much more than a hack, but since no one else has
jumped in with a better answer, I thought I'd offer up what little I
know so far.
Another curious thing... since SVG really does have this
device-independent scalability and is pixel-oriented, I discovered that
if instead of using batik-rasterizer, you open an SVG in squiggle,
maximize it to your full screen, then export it as jpeg or tiff, that
your resulting raster image is of much higher quality than if you did
not maximize the window. No actions or menu selections, just "making
the window bigger".
If any of the much wiser and more experienced folks here know of better
ways and/or better "tricks" to produce print-quality raster images from
SVG source images and batik-rasterizer, I'd love to hear about it, too.
Jay Baldwin
Application Development Team Leader
***************************************************
Tweddle Litho Company
24700 Maplehurst, Clinton Twp, MI 48036-1336
+1.586.840.1324
http://www.tweddle.com/
-----Original Message-----
From: Woods, Christopher [mailto:***@EO.Kollmorgen.com]
Sent: Tuesday, January 10, 2006 2:32 PM
To: batik-***@xmlgraphics.apache.org
Subject: Svg to png rasterizer resolution - output blurry
Hi,
I'm using batik 1.6 to convert a directory of .svg images to .png with
the following command:
java -jar batik-rasterizer.jar -d myDir -m image/png -dpi 300
samples/*.svg
The result is blurry .png images. I suspect the -dpi option is to blame
as the resulting file sizes are the same as when I specify no -dpi
option (I understand the default is 96 dpi). Can anyone point me in the
right direction. Thanks very much. Cheers.
chris
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-***@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-***@xmlgraphics.apache.org