






































|
This page describes the features of the SVG Rasterizer utility that
comes with the Batik distribution. It discusses the following:
The SVG Rasterizer is a utility that can convert SVG files to a
raster format. The tool can convert individual files or sets of
files, making it easy to convert entire directories of SVG
files. The provided formats are JPEG, PNG, and TIFF, however the
design allows new formats to be added easily.
|
 |  |  |  | Rasterizing one or several SVG files |  |  |  |  |
The method for starting the rasterizer depends on the distribution of Batik
that you chose to download. The following describes how to start the viewer
for each distribution.
 |  |  |  | Using the binary distribution |  |  |  |  |
If you downloaded the binary distribution of Batik, you should have
gotten a file called batik-1.0beta.zip, and, after expanding that
file, a JAR (Java ARchive) file called batik-rasterizer.jar.
To start the rasterizer, open a console, go to the directory where you
expanded the distribution (and where batik-rasterizer.jar is located) and
simply type the following at the command prompt :
java -jar batik-rasterizer.jar [@files]
For example, if you type:
java -jar batik-rasterizer.jar samples/batikFX.svg
you will see the following printout:
Converting file: samples/BatikFX.svg to samples/BatikFX.png
Once the conversion is complete, you will find a batikFX.png file in the samples
directory
You can pass options to the command line:
java -jar batik-rasterizer.jar [options] [@files]
Where the options are:
- -d <dir|file>. Output directory. If there is a single input file, this can be a file.
- -m <mimeType>. Output mime type, one of image/png, image/jpeg, application/pdf, image/tiff.
- -w <width>. Output width. This is a floating point value.
- -h <height>. Output height. This is a floating point value.
- -a <area>. Output area. The format for <area> is x,y,w,h, where x, y, w and h
are floating point values.
- -bg <color>. Uuput color. The format for <color> is a.r.g.b, where a, r, g and b
are integer values.
- -cssMedia <media>.CSS media type for which the source SVG files should be
converted.
- -cssAlternate <alternate>. CSS alternate stylesheet to use when converting the source
SVG files.
- -cssUser <userStylesheet>. CSS user stylesheet URI to apply to converted SVG documents
in addition to any other referened or embeded stylesheets.
- -lang <userLanguage>. User language to use when converting SVG documents.
- -q <quality>. Quality for the output image. This is only relevant for the
image/jpeg mime type.
- -dpi <resolution>. Resolution for the ouptut image.
- -validate. Controls whether the source SVG files should be validated.
For example:
- java -jar batik-rasterizer.jar -d myDir -m image/jpg samples\*.svg will generate JPEG images
for all the SVG files found in the samples directory.
|
|
|
|