blob: 8518c42936dd1ae3f7b3a594b4be8253f52ab320 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
<!--
<link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/style.css">
-->
<link rel="stylesheet" type="text/css" media="screen" href="https://www.apache.org/css/code.css">
<link href="/css/profile.css" rel="stylesheet" type="text/css" />
<link href="/css/xmlgraphics.css" rel="stylesheet" type="text/css" />
<link href="/css/print.css" rel="stylesheet" type="text/css" media="print" />
<script src="https://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.stoc.js"></script>
<script>
$(document).ready(function(){
$('ul#navigation a').each(function() {
if (this.href === window.location.href)
{ $(this). attr('id', 'forefront');}
});
$('ul#navigation a#forefront').each(function() {
});
})
$(function(){
$("#items").stoc({ search: "#content", stocTitle: "<h3>Page Contents</h3>" });
});
</script>
<style>
.highlight {color: red;}
</style>
</head>
<body>
<div id="banner">&nbsp;
</div>
<div id="navigation">
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p><a href="/"><img alt="Apache XML Graphics Project Logo" src="/images/apache-xml-graphics.gif" title="Apache XML Graphics Project" /></a></p>
<h1 id="apache-batik">Apache Batik<a class="headerlink" href="#apache-batik" title="Permanent link">&para;</a></h1>
<ul>
<li><a href="/batik/">Overview</a></li>
<li><a href="/batik/license.html">License</a></li>
<li><a href="/batik/download.html">Download</a></li>
<li><a href="/batik/install.html">Notes</a></li>
<li><a href="/batik/status.html">Status</a></li>
<li><a href="/batik/demo-static.html">Demo</a></li>
<li><a href="/batik/faq.html">FAQs</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/XMLGRAPHICSBATIK">Batik Wiki</a></li>
<li><a href="/batik/mailing-lists.html">Mailing lists</a></li>
<li><a href="/batik/contributors.html">Contributors</a></li>
<li><a href="https://issues.apache.org/jira/issues/?jql=project%20%3D%20BATIK%20AND%20resolution%20%3D%20Unresolved%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20ORDER%20BY%20priority%20DESC">Bug database</a></li>
<li><a href="/batik/uses.html">Projects using Batik</a></li>
<li>
<h2 id="batik-tools">Batik Tools<a class="headerlink" href="#batik-tools" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="/batik/tools/">Overview</a></li>
<li><a href="/batik/tools/browser.html">Browser</a></li>
<li><a href="/batik/tools/rasterizer.html">Rasterizer</a></li>
<li><a href="/batik/tools/font-converter.html">Font converter</a></li>
<li><a href="/batik/tools/pretty-printer.html">Pretty printer</a></li>
</ul>
</li>
<li>
<h2 id="using-batik">Using Batik<a class="headerlink" href="#using-batik" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="/batik/using/">Overview</a></li>
<li><a href="/batik/using/architecture.html">Architecture</a></li>
<li><a href="/batik/javadoc/">Javadoc APIs</a></li>
<li><a href="/batik/using/dom-api.html">DOM API</a></li>
<li><a href="/batik/using/parsers.html">Parsers</a></li>
<li>
<h3 id="scripting">Scripting<a class="headerlink" href="#scripting" title="Permanent link">&para;</a></h3>
</li>
<li><a href="/batik/using/scripting/ecmascript.html">Scripting with ECMAScript</a></li>
<li><a href="/batik/using/scripting/java.html">Scripting with Java</a></li>
<li><a href="/batik/using/scripting/security.html">Scripting with Security</a></li>
<li><a href="/batik/using/svg-generator.html">SVG generator</a></li>
<li><a href="/batik/using/swing.html">Swing components</a></li>
<li><a href="/batik/using/transcoder.html">Transcoder API</a></li>
<li><a href="/batik/using/extending.html">Extending Batik</a></li>
</ul>
</li>
<li>
<h2 id="development">Development<a class="headerlink" href="#development" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="/batik/dev/">Overview</a></li>
<li><a href="/batik/dev/branches.html">Branches</a></li>
<li><a href="/batik/dev/svg12.html">SVG 1.2 support</a></li>
<li><a href="/batik/dev/test.html">Test infrastructure</a></li>
</ul>
</li>
</ul>
<h1 id="apache-xml-graphics">Apache&trade; XML Graphics<a class="headerlink" href="#apache-xml-graphics" title="Permanent link">&para;</a></h1>
<ul>
<li>
<h3 id="project-overview">Project Overview<a class="headerlink" href="#project-overview" title="Permanent link">&para;</a></h3>
<ul>
<li><a href="/team.html">Who We Are</a></li>
<li><a href="/legal.html">Legal Stuff</a></li>
<li><a href="/charter.html">Project Charter</a></li>
<li><a href="/mail.html">Mailing Lists</a></li>
<li><a href="/repo.html">Code Repositories</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">ASF Sponsorship Program</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html">ASF Thanks</a></li>
<li><a href="https://www.apache.org/licenses/">Licenses</a></li>
<li><a href="/security.html">Apache XML Graphics Security</a></li>
<li><a href="https://www.apache.org/security/">ASF Security</a></li>
</ul>
</li>
</ul>
<h1 id="sub-projects">Sub Projects<a class="headerlink" href="#sub-projects" title="Permanent link">&para;</a></h1>
<ul>
<li><a href="/fop/">Apache FOP</a></li>
<li><a href="/commons/">Apache XML Graphics Commons</a></li>
</ul>
<h2 id="search-apache-xml-graphics">Search Apache XML Graphics<a class="headerlink" href="#search-apache-xml-graphics" title="Permanent link">&para;</a></h2>
<form name="search" id="search" action="https://www.google.com/search" method="get">
<input value="xmlgraphics.apache.org" name="sitesearch" type="hidden"/>
<input type="text" name="q" id="query" />
<input type="submit" id="submit" value="Search" />
</form>
<h3 id="apachecon-n-america">ApacheCon N. America<a class="headerlink" href="#apachecon-n-america" title="Permanent link">&para;</a></h3>
<p><a title="ApacheCon North America" href="https://www.apachecon.com"><img class="apachecon_logo" alt="ApacheCon North America" src="https://www.apachecon.com/images/landingpage/apachecon-logo.png" width="200" /></a><br /><br /></p>
<ul>
<li><strong><a href="https://www.apachecon.com/">ApacheCon NA</a></strong></li>
</ul>
<p>Hope to see you there!</p>
<h3 id="apachecon-europe">ApacheCon Europe<a class="headerlink" href="#apachecon-europe" title="Permanent link">&para;</a></h3>
<p><a title="ApacheCon Europe" href="https://www.apachecon.com"><img class="apachecon_logo" alt="ApacheCon Europe" src="https://www.apachecon.com/images/landingpage/apachecon-logo.png" width="200" /></a><br /><br /></p>
<ul>
<li><strong><a href="https://www.apachecon.com/">ApacheCon Europe</a></strong></li>
</ul>
<p>Hope to see you there!</p>
<p><a title="Apache Software Foundation" href="https://www.apache.org"><img id="asf_logo_url" alt="Apache Software Foundation " src="/images/asf_logo_url.png" width="200" /></a><br /><br /></p>
<p><a title="Support the Apache Software Foundation" href="https://donate.apache.org/"><img id="asf_support_url" alt="Support the Apache Software Foundation " src="https://blogs.apache.org/foundation/mediaresource/d67ca611-a57c-462d-ac23-95063f81d175" width="200" /></a></p>
<script>
$(document).ready(function () {
$('#navigation :header').click(function () {
var text = $(this).siblings('ul');
if (text.is(':hidden')) {
text.slideDown('200');
} else {
text.slideUp('200');
}
});
if ($('#navigation :header').siblings('ul')) {
$('#navigation :header').append(' &raquo;');
}
$('#navigation > ul > li ul').hide();
var str=location.href.toLowerCase();
$("#navigation li a").each(function() {
if (str.indexOf(this.href.toLowerCase()) > -1) {
$(this).parents().slideDown('200');
$("li.highlight").removeClass("highlight");
$(this).parent().addClass("highlight");
}
});
})
</script> </div>
<div id="bannertext" style="border-bottom: 2px dashed #666666; height: 100px;">
<a href="/batik/"><img src="/images/apache-batik-logo.png" alt="The Apache FOP Project" width="256" height="96" style="float:left; margin-right: 15px;" /></a>
<h2>The Apache&trade; Batik Project</h2>
</div>
<h1>SVG Rasterizer</h1>
<h1>SVG Rasterizer</h1>
<p>This page describes the features of the SVG Rasterizer utility that comes with the Batik distribution. 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 <abbr title="Joint Photography Expert Group">JPEG</abbr>, <abbr title="Portable Network Graphics">PNG</abbr> and <abbr title="Tagged Image File Format">TIFF</abbr>, however the design allows new formats to be added easily. In addition, the rasterizer can (despite its name) transcode to <abbr title="Portable Document Format">PDF</abbr>.</p>
<h2 id="downloading">Downloading the rasterizer</h2>
<p>Refer to the <a href="../install.html">install page</a> and the <a href="/batik/download.html">download area</a> to find out what to download and how to install it. Remember that you can get either the source or binary distribution.</p>
<h2 id="using">Rasterizing one or several SVG files</h2>
<p>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.</p>
<h3 id="using-binary">Using the binary distribution</h3>
<p>If you downloaded the binary distribution of Batik, you should have a file called <code>batik-1.6.zip</code> (or similar), and, after expanding that file, a jar file called <code>batik-rasterizer.jar</code>. To start the rasterizer, open a console, go to the directory where you expanded the distribution (and where <code>batik-rasterizer.jar</code> is located) and simply type the following at the command prompt:</p>
<div class="highlight"><pre><span></span>java -jar batik-rasterizer.jar FILES
</pre></div>
<p>For example, if you type:</p>
<div class="highlight"><pre><span></span>java -jar batik-rasterizer.jar samples/batikFX.svg
</pre></div>
<p>you will see the following printout:</p>
<div class="highlight"><pre><span></span>Converting file: samples/batikFX.svg to samples/batikFX.png
</pre></div>
<p>Once the conversion is complete, you will find a <code>batikFX.png</code> file in the samples directory.</p>
<p>You can pass options on the command line:</p>
<div class="highlight"><pre><span></span>java -jar batik-rasterizer.jar [OPTIONS] FILES
</pre></div>
<p>where, as options:</p>
<p><strong><code>-d</code></strong> <em><code>dir|file</code></em>
:
specifies the output directory, or the output file if there is only a single input file,</p>
<p><strong><code>-m</code></strong> <em><code>mime-type</code></em>
:
specifies the output MIME type, which should be one of <code>image/png</code>, <code>image/jpeg</code>, <code>image/tiff</code> or <code>application/pdf</code>,</p>
<p><strong><code>-w</code></strong> <em><code>width</code></em>
:
specifies the output width as a floating point value,</p>
<p><strong><code>-h</code></strong> <em><code>height</code></em>
:
specifies the output height as a floating point value,</p>
<p><strong><code>-maxw</code></strong> <em><code>width</code></em>
:
specifies the maximum output width as a floating point value,</p>
<p><strong><code>-maxh</code></strong> <em><code>height</code></em>
:
specifies the maximum output height as a floating point value,</p>
<p><strong><code>-a</code></strong> <em><code>x</code></em> <strong><code>,</code></strong> <em><code>y</code></em> <strong><code>,</code></strong> <em><code>width</code></em> <strong><code>,</code></strong> <em><code>height</code></em>
:
specifies the area of interest (as floating point values) of the SVG file to rasterize (and if not specified, will be determined by the <code>width</code> / <code>height</code> / <code>viewBox</code> attributes if specified in the document, and be 0,0,400,400 otherwise),</p>
<p><strong><code>-bg</code></strong> <em><code>alpha</code></em> <strong><code>.</code></strong> <em><code>red</code></em> <strong><code>.</code></strong> <em><code>green</code></em> <strong><code>.</code></strong> <em><code>blue</code></em>
:
specifies the background fill color as an ARGB quadruple, where each component is an integer in the range 0—255,</p>
<p><strong><code>-cssMedia</code></strong> <em><code>media</code></em>
:
specifies the CSS media type used for matching CSS rules,</p>
<p><strong><code>-cssAlternate</code></strong> <em><code>file|uri</code></em>
:
specifies the CSS alternate stylesheet to use,</p>
<p><strong><code>-cssUser</code></strong> <em><code>file|uri</code></em>
:
specifies the CSS user stylesheet to use in addition to any other referenced or embedded stylesheets,</p>
<p><strong><code>-font-family</code></strong> <em><code>defaultFontFamily</code></em>
:
specifies default font family to be used when none is specified,</p>
<p><strong><code>-lang</code></strong> <em><code>language-code</code></em>
:
specifies the <a href="http://www.faqs.org/rfcs/rfc3066.html">RFC 3066</a> language code to use,</p>
<p><strong><code>-q</code></strong> <em><code>quality</code></em>
:
specifies the quality of the output image, as a floating point number in the range 0 &lt; <em>quality</em> &lt; 1 when generating JPEG images,</p>
<p><strong><code>-indexed</code></strong> <em><code>1|2|4|8</code></em>
:
specifies the number of bits per pixel of the output image, using an adaptive pallete, resulting in an indexed image when generating PNG images,</p>
<p><strong><code>-dpi</code></strong> <em><code>resolution</code></em>
:
specifies the resolution of the output image in dots per inch,</p>
<p><strong><code>-validate</code></strong>
:
specifies that the source SVG files must be validated against their DTDs,</p>
<p><strong><code>-onload</code></strong>
:
specifies that the SVG files should be rasterized after dispatching the SVG load event,</p>
<p><strong><code>-snapshotTime</code></strong>
:
specifies the document time that should be seeked to before rasterizing the document, implying -onload,</p>
<p><strong><code>-scriptSecurityOff</code></strong>
:
specifies that any security checks on the scripts running as a result of dispatching the SVG load event will be bypassed,</p>
<p><strong><code>-anyScriptOrigin</code></strong>
:
specifies that scripts can be loaded from any location, while by default they can only be loaded from the same location as the document, and</p>
<p><strong><code>-scripts</code></strong> <em><code>allowed-script-types</code></em>
:
specifies a list of script types (i.e., values for the <code>type</code> attribute on <code>script</code> elements) that should be loaded.</p>
<p>For example:</p>
<div class="highlight"><pre><span></span>java -jar batik-rasterizer.jar -d myDir -m image/jpeg samples/*.svg
</pre></div>
<p>will generate JPEG images for all the SVG files found in the samples directory.</p>
<h3 id="usingSource">Using the source distribution</h3>
<p>If you downloaded the source distribution of Batik, you got a zip or tar file that expanded into a directory called <code>xml-batik</code> or <code>batik-</code><em><code>version</code></em>. In that directory, you can find build scripts for the platform you are running on. For example, there is a <code>build.bat</code> script for users of the Windows platform and there is a <code>build.sh</code> script for UNIX users.</p>
<p>To start the rasterizer you should:</p>
<ul>
<li>
<p>Make sure that your <code>JAVA_HOME</code> environment variable is set to your JDK installation directory.</p>
</li>
<li>
<p>Open a command line window and go to the <code>xml-batik</code> or <code>batik-</code><em><code>version</code></em> directory where the Batik distribution was expanded.</p>
</li>
</ul>
<p>-
For Windows, type the following at the command prompt:</p>
<div class="highlight"><pre><span></span>build svgrasterizer
</pre></div>
<p>and for Unix:</p>
<div class="highlight"><pre><span></span>./build.sh svgrasterizer
</pre></div>
<p>This will print out a help message for the rasterizer.</p>
<p>You can pass options to the rasterizer as follows, for Windows:</p>
<div class="highlight"><pre><span></span>build svgrasterizer [OPTIONS] FILES
</pre></div>
<p>and for Unix:</p>
<div class="highlight"><pre><span></span>./build.sh svgrasterizer [OPTIONS] FILES
</pre></div>
<p>Refer to <a href="#using-binary">“Using the binary distribution”</a> for an explanation of the options.</p>
<h2 id="task">Rasterizer Ant task</h2>
<p>The Rasterizer task is an <a href="http://ant.apache.org/">Ant</a> version of the rasterizer utility. It fulfills the same basic purpose as the utility but has a different syntax and a slightly different set of features.</p>
<p>The task is able to produce four raster formats: <abbr title="Portable Network Graphics">PNG</abbr>, <abbr title="Joint Photographic Expert Group">JPEG</abbr>, <abbr title="Tagged Image File Format">TIFF</abbr> and <abbr title="Portable Document Format">PDF</abbr>.</p>
<h3 id="initTask">Using the rasterizer task</h3>
<p>The first thing to do is to compile rasterizer task classes. Download the source distribution of Batik and see the <code>README</code> file in the <code>contrib/rasterizertask</code> directory for more instructions. The build procedure works the same way as when building Batik itself.</p>
<p>After building, ensure that the generated <code>batik-rasterizer.jar</code> and the classes (or jar file) of the rasterizer task are in your <code>CLASSPATH</code>.</p>
<p>Next you have to define the task in your Ant project. To do this, add the following line either after the <code>project</code> start tag or after the <code>target</code> start tag in the target you are using the rasterizer task:</p>
<div class="highlight"><pre><span></span><span class="nt">&lt;taskdef</span> <span class="na">name=</span><span class="s">&quot;rasterize&quot;</span>
<span class="na">classname=</span><span class="s">&quot;org.apache.tools.ant.taskdefs.optional.RasterizerTask&quot;</span><span class="nt">/&gt;</span>
</pre></div>
<p>Now you can use the rasterizer task in your project. See the <a href="#taskParameters">parameters section</a> for an explanation of the available parameters or the <a href="#taskExamples">examples section</a> to see few usage examples.</p>
<h3 id="taskParameters">Parameters of the Ant task</h3>
<p>The following table lists the attributes that may be specified on the <code>rasterize</code> task element.</p>
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td>result</td>
<td>Sets the type of the result image. Only one of the following values must be used: <code>image/png</code>, <code>image/jpeg</code>, <code>image/tiff</code> and <code>application/pdf</code>. The value must be in lowercase letters.</td>
<td>Yes</td>
</tr>
<tr>
<td>height</td>
<td>Sets the height of the result image in pixels. The task calculates the height from the SVG file if this parameter has not been set. The rasterizer keeps the aspect ratio of the SVG file even if the both <code>height</code> and <code>width</code> have been set.</td>
<td>No</td>
</tr>
<tr>
<td>width</td>
<td>Sets the width of the result image in pixels. The task calculates the width from the SVG file if this parameter has not been set. The rasterizer keeps the aspect ratio of the SVG file even if the both <code>height</code> and <code>width</code> have been set.</td>
<td>No</td>
</tr>
<tr>
<td>maxheight</td>
<td>Sets the maximum height of the result image in pixels. The image won’t be higher than defined in this parameter, regardless of the size set in the image itself or in other parameters. This is a floating point value.</td>
<td>No</td>
</tr>
<tr>
<td>maxwidth</td>
<td>Sets the maximum width of the result image in pixels. The image won’t be wider than defined in this parameter, regardless of the size set in the image itself or in other parameters. This is a floating point value.</td>
<td>No</td>
</tr>
<tr>
<td>quality</td>
<td>Sets the quality of the produced image. The value must be greater than 0 but smaller than 1, larger numbers meaning higher quality. The quality value is used only with JPEG images. The default quality value is 0.99.</td>
<td>No</td>
</tr>
<tr>
<td>area</td>
<td>Defines the area in the SVG file which will be rasterized. Parts outside this area are discarded and don’t show in the result image. The area attribute value has four integers separated by commas. The first two integers set the x and y coordinates of the upper left corner of the area, respectively. The last two integers set the width and height of the area, respectively. For example, <code>10, 20, 100, 200</code> sets the rectangular area from point <code>10, 10</code> to point <code>110, 220</code>. The specified area is applied to all images if more than one file is rasterized during one task.</td>
<td>No</td>
</tr>
<tr>
<td>bg</td>
<td>Sets the background color of the result image. The <code>bg</code> attribute value is either three or four integers separated with commas. The four values are alpha channel, red, green, and blue, respectively. If only three values are given, then the values are red, green, and blue and the alpha channel is automatically set to 255 (opaque). All values have to between 0 and 255. The default value is none which means that background is transparent and not filled with any color.</td>
<td>No</td>
</tr>
<tr>
<td>media</td>
<td>CSS media type that is used to select a CSS stylesheet. The selected stylesheet is then used to rasterize the SVG files. Only the visual media group is supported (see the <a href="http://www.w3.org/TR/REC-CSS2/">CSS2 specification</a> for more information about media groups). The default value is <code>screen</code>.</td>
<td>No</td>
</tr>
<tr>
<td>dpi</td>
<td>Resolution for the result image. The attribute value is used to compute the “pixel to millimeter” ratio used when processing SVG files. The default value is 96.</td>
<td>No</td>
</tr>
<tr>
<td>lang</td>
<td>Language which is used select language specific areas from the SVG file during the rasterizing process. The valid values are defined in <a href="http://www.faqs.org/rfcs/rfc3066.html">RFC3066</a>. The default value is <code>en</code>.</td>
<td>No</td>
</tr>
<tr>
<td>src</td>
<td>Name of a one input file. Use this parameter to convert just one file whose name and location are known. The <code>dest</code> parameter must also be given.</td>
<td>One of the following is required: <code>src</code> attribute, <code>srcdir</code> attribute or <code>fileset</code> element(s).</td>
</tr>
<tr>
<td>dest</td>
<td>Name of a one output file. Used this with <code>src</code> parameter only. The output directory is created if it doesn’t exist.</td>
<td>Required if <code>src</code> is used.</td>
</tr>
<tr>
<td>srcdir</td>
<td>Name of the input directory. <code>srcdir</code> and <code>fileset</code> elements can be combined and <code>srcdir</code> can be omitted if there is at least one <code>fileset</code> child element. <code>srcdir</code> file selection can be controlled with <code>include</code>, <code>exclude</code>, etc. child elements. Note that without control parameters the task tries to rasterize <em>all</em> files in the given directory.</td>
<td>One of the following is required: <code>src</code> attribute, <code>srcdir</code> attribute or <code>fileset</code> element(s).</td>
</tr>
<tr>
<td>destdir</td>
<td>Name of an output directory. Use this with the <code>srcdir</code> attribute or <code>fileset</code> elements. The task generates the names of the output images by changing the suffix of the input file names to correspond the result image type. A suffix is added if the input file doesn’t have one. Output directories are created if they don’t exist.</td>
<td>Required if <code>srcdir</code> attribute or <code>fileset</code> elements are used.</td>
</tr>
<tr>
<td>classname</td>
<td>Class name of the XML parser used to parse SVG images. The value can be either the complete classname with package information included or the special name <code>jaxp</code>, which means any available parser in the <code>CLASSPATH</code> that supports JAXP. See the Batik code for the default value.</td>
<td>No</td>
</tr>
</tbody>
</table>
<p>You can use <code>fileset</code> elements to select input files and directories. See the <a href="http://ant.apache.org/">Ant</a> documentation to learn how to use <a href="https://ant.apache.org/manual/Types/fileset.html">filesets</a>.</p>
<h3 id="taskExamples">Examples of using the rasterizer task</h3>
<p>The following example is the complete Ant project that converts an SVG image (called <code>input.svg</code>) to a PNG image (called <code>output.png</code>):</p>
<div class="highlight"><pre><span></span><span class="cp">&lt;?xml version=&quot;1.0&quot;?&gt;</span>
<span class="nt">&lt;project</span> <span class="na">name=</span><span class="s">&quot;RasterizerExample&quot;</span> <span class="na">default=</span><span class="s">&quot;main&quot;</span> <span class="na">basedir=</span><span class="s">&quot;.&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;taskdef</span> <span class="na">name=</span><span class="s">&quot;rasterize&quot;</span>
<span class="na">classname=</span><span class="s">&quot;org.apache.tools.ant.taskdefs.optional.RasterizerTask&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;target</span> <span class="na">name=</span><span class="s">&quot;main&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;rasterize</span> <span class="na">result=</span><span class="s">&quot;image/png&quot;</span> <span class="na">src=</span><span class="s">&quot;input.svg&quot;</span> <span class="na">dest=</span><span class="s">&quot;output.png&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/target&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</pre></div>
<p>The next example is just one task in a project. It converts all files with a <code>.svg</code> suffix in the <code>images</code> directory and all files in the <code>images2</code> directory to TIFF images. The resulting image files are placed in the <code>results</code> directory.</p>
<div class="highlight"><pre><span></span><span class="nt">&lt;rasterize</span> <span class="na">result=</span><span class="s">&quot;image/tiff&quot;</span> <span class="na">destdir=</span><span class="s">&quot;results&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;fileset</span> <span class="na">dir=</span><span class="s">&quot;images&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;include</span> <span class="na">name=</span><span class="s">&quot;**/*.svg&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/fileset&gt;</span>
<span class="nt">&lt;fileset</span> <span class="na">dir=</span><span class="s">&quot;images2&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/rasterize&gt;</span>
</pre></div>
<div class="clear"></div>
<div id="footer">
<div class="copyright">
<div style="float:left; padding: 7px;">
<a title="Apache Software Foundation" href="http://www.apache.org"><img id="asf-feather-logo" alt="Apache Software Foundation" src="/images/asf_logo_url.png" width="200" /></a>
</div>
<p>
Copyright &copy; 2016 The Apache Software Foundation, Licensed under
the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
<br />
Apache, Apache XML Graphics, Apache FOP, Apache Batik, the Apache feather logo, and the
Apache XML Graphics logos are trademarks of <a href="http://www.apache.org">The Apache
Software Foundation</a>. All other marks mentioned may be trademarks or registered
trademarks of their respective owners.
<br />
</p>
</div>
</div>
</body>
</html>