http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Overview
FAQ
License
Download
Install
Demo

In the news

Tools and Apps
Browser
Rasterizer
Font Converter
Pretty-printer

Architecture
Generator
DOM API
Scripting
JSVGCanvas
Transcoder API

Extensions

Testing

Contributors
Mail Lists

CVS Repository
Bug Database

Status

Glossary


Introduction

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.


Downloading the rasterizer

Refer to the install page and the download area to find out what to download and how to install it. Remember that you can get either the developer distribution or the binary distribution.


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 [-d <directory>] [-m <mimeType>] [@files]

Where:

  • -d <directory> lets you select the directory where the raster files will be stored.
  • -m <mimeType> lets you select the mime type corresponding to the desired raster format for the generated images. Currently, the tool supports image/jpg, image/png, and image/tiff. The default value is image/png

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.

Using the developer distribution

If you downloaded the developer distribution of Batik, you got a zip or tar file that expanded into an xml-batik directory. In that directory, you can find build scripts for the platform you are running on. For example, there is a build.bat script for users of the Windows platform and there is a build.sh script for UNIX users.

To start the rasterizer you should:

  • Make sure the xml-batik directory is in your PATH environment variable
  • Make sure the ANT_HOME environment variable is set to the xml-batik directory
  • Make sure that your JAVA_HOME environment variable is set to your JDK installation directory
  • Open a command line window and go to the xml-batik directory where the Batik distribution was expanded
  • UNIX users. If you have not done so already, make the build.sh script executable:
    chmod +x build.sh
  • At the command prompt, type:
    Windows: build svgrasterizer.
    UNIX: build.sh svgrasterizer.
    This will printout a help message for the rasterizer

You can pass options to the rasterizer as follows:

Windows: build svgrasterizer [-d <directory>] [-m <mimeType>] [@files]

UNIX: build.sh svgrasterizer [-d <directory>] [-m <mimeType>] [@files]

Refer to "Using the binary distribution" for an explanation of these options




Copyright © 2000-2001 The Apache Software Foundation. All Rights Reserved.