2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2003-04-16 12:44:44 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2003-04-16 12:44:44 +00:00
|
|
|
<title>Image Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="image">Image</h2>
|
2003-04-16 12:44:44 +00:00
|
|
|
<h3>Description</h3>
|
|
|
|
<p>Applies a chain of image operations on a set of files.</p>
|
2018-01-20 10:11:35 +01:00
|
|
|
<p>Requires <a href="../install.html#librarydependencies">Java Advanced Image API</a> from Sun.</p>
|
2003-04-16 12:44:44 +00:00
|
|
|
|
|
|
|
<h5>Overview of used datatypes</h5>
|
|
|
|
<img src="image-classdiagram.gif" border="0" alt="Class-Diagram">
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2003-04-16 12:44:44 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>failonerror</td>
|
|
|
|
<td>Boolean value. If <q>false</q>, note errors to the output but keep going.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>srcdir</td>
|
|
|
|
<td>Directory containing the images.</td>
|
|
|
|
<td>Yes, unless nested fileset is used</td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>encoding</td>
|
|
|
|
<td>Image encoding type.<br/>Valid (case insensitive)
|
|
|
|
are: <q>jpg</q>, <q>jpeg</q>, <q>tif</q>, <q>tiff</q>
|
2003-04-16 12:44:44 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>jpeg</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>overwrite</td>
|
|
|
|
<td>Boolean value. Sets whether or not to overwrite a file if there is naming conflict.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>gc</td>
|
|
|
|
<td>Boolean value. Enables garbage collection after each image processed.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>destdir</td>
|
|
|
|
<td>Directory where the result images are stored.</td>
|
|
|
|
<td>No; defaults to value of <var>srcdir</var></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<!-- attributes inherited from MatchingTask -->
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>includes</td>
|
|
|
|
<td>comma- or space-separated list of patterns of files that must be included.</td>
|
|
|
|
<td>No; defaults to all (<q>**</q>)</td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>includesfile</td>
|
|
|
|
<td>name of a file. Each line of this file is taken to be an include pattern</td>
|
|
|
|
<td>No</td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>excludes</td>
|
|
|
|
<td>comma- or space-separated list of patterns of files that must be excluded.</td>
|
|
|
|
<td>No; defaults to default excludes or none if <var>defaultexcludes</var> is <q>no</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>excludesfile</td>
|
|
|
|
<td>name of a file. Each line of this file is taken to be an exclude pattern</td>
|
|
|
|
<td>No</td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>defaultexcludes</td>
|
|
|
|
<td>indicates whether default excludes should be used or not (<q>yes|no</q>).</td>
|
|
|
|
<td>No; defaults to <q>yes</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>caseSensitive</td>
|
|
|
|
<td>Boolean value. Sets case sensitivity of the file system.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>followSymlinks</td>
|
|
|
|
<td>Boolean value. Sets whether or not symbolic links should be followed.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This task forms an implicit <a href="../Types/fileset.html">FileSet</a> and supports most
|
|
|
|
attributes of <code><fileset></code> as well as the
|
|
|
|
nested <code><include></code>, <code><exclude></code>
|
|
|
|
and <code><patternset></code> elements.</p>
|
2003-04-16 12:44:44 +00:00
|
|
|
|
|
|
|
<h4>ImageOperation</h4>
|
|
|
|
<p>Adds an ImageOperation to chain.</p>
|
2018-03-05 21:01:42 +01:00
|
|
|
<h5>Nested elements</h5>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>ImageOperation can handle
|
|
|
|
nested <code>Rotate</code>, <code>Draw</code>, <code>Rectangle</code>, <code>Text</code>
|
|
|
|
and <code>Scale</code> objects.</p>
|
2003-04-16 12:44:44 +00:00
|
|
|
|
|
|
|
<h4>Rotate</h4>
|
|
|
|
<p>Adds a Rotate ImageOperation to chain.</p>
|
|
|
|
<h5>Parameters</h5>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2003-04-16 12:44:44 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>angle</td>
|
|
|
|
<td>Float value. Sets the angle of rotation in degrees.</td>
|
|
|
|
<td>No; defaults to <q>0.0F</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h4>Scale</h4>
|
|
|
|
<p>Adds a Scale ImageOperation to chain.</p>
|
|
|
|
<h5>Parameters</h5>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2003-04-16 12:44:44 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
2018-01-22 23:52:21 +01:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>proportions</td>
|
|
|
|
<td>Sets which dimension to control proportions from. Valid values are:
|
2018-01-22 23:52:21 +01:00
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><q>ignore</q>— treat the dimensions independently.</li>
|
|
|
|
<li><q>height</q>—keep proportions based on the width.</li>
|
|
|
|
<li><q>width</q>—keep proportions based on the height.</li>
|
|
|
|
<li><q>cover</q>—keep proportions and fit in the supplied dimensions.</li>
|
|
|
|
<li><q>fit</q>—keep proportions and cover the supplied dimensions.</li>
|
2018-01-22 23:52:21 +01:00
|
|
|
</ul>
|
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>ignore</q></td>
|
2018-01-22 23:52:21 +01:00
|
|
|
</tr>
|
2003-04-16 12:44:44 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>width</td>
|
|
|
|
<td>Sets the width of the image, either as an integer or a %.</td>
|
2003-04-16 12:44:44 +00:00
|
|
|
<!-- todo: if integer, what kind? cm, px, inches, ... -->
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>100%</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>height</td>
|
|
|
|
<td>Sets the height of the image, either as an integer or a %.</td>
|
2003-04-16 12:44:44 +00:00
|
|
|
<!-- todo: if integer, what kind? cm, px, inches, ... -->
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>100%</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h4>Draw</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Adds a Draw ImageOperation to chain. DrawOperation DataType objects can be nested inside the Draw
|
|
|
|
object.</p>
|
2003-04-16 12:44:44 +00:00
|
|
|
<h5>Parameters</h5>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2003-04-16 12:44:44 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>xloc</td>
|
|
|
|
<td>X-Position where to draw nested image elements.</td>
|
|
|
|
<td>No; defaults to <q>0</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>yloc</td>
|
|
|
|
<td>Y-Position where to draw nested image elements.</td>
|
|
|
|
<td>No; defaults to <q>0</q></td>
|
2003-04-16 12:44:44 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2009-08-25 13:52:17 +00:00
|
|
|
<h4>mapper</h4>
|
2010-11-11 17:04:16 +00:00
|
|
|
<p><em>Since Apache Ant 1.8.0</em></p>
|
2009-08-25 13:52:17 +00:00
|
|
|
|
|
|
|
<p>You can define filename transformations by using a
|
2018-02-28 07:58:59 +01:00
|
|
|
nested <a href="../Types/mapper.html">mapper</a> element. The default mapper used
|
|
|
|
by <code><image></code> is the <a href="../Types/mapper.html#identity-mapper">identity
|
|
|
|
mapper</a>.</p>
|
2009-08-25 13:52:17 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>You can also use a <code>filenamemapper</code> type in place of the <code>mapper</code>
|
|
|
|
element.</p>
|
2009-08-25 13:52:17 +00:00
|
|
|
|
2003-04-16 12:44:44 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<image destdir="samples/low" overwrite="yes">
|
|
|
|
<fileset dir="samples/full">
|
|
|
|
<include name="**/*.jpg"/>
|
|
|
|
</fileset>
|
|
|
|
<scale width="160" height="160" proportions="fit"/>
|
|
|
|
</image></pre>
|
2003-08-25 15:58:38 +00:00
|
|
|
<p>Create thumbnails of my images and make sure they all fit within the 160x160 size whether the
|
|
|
|
image is portrait or landscape.</p>
|
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2003-04-16 12:44:44 +00:00
|
|
|
<image srcdir="src" includes="*.png">
|
2003-08-25 15:58:38 +00:00
|
|
|
<scale proportions="width" width="40"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</image></pre>
|
|
|
|
<p>Creates a thumbnail for all PNG files in <samp>src</samp> of the size of 40 pixel keeping the
|
|
|
|
proportions and stores the <samp>src</samp>.</p>
|
2003-04-16 12:44:44 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2003-04-16 12:44:44 +00:00
|
|
|
<image srcdir="src" destdir="dest" includes="*.png">
|
2003-08-25 15:58:38 +00:00
|
|
|
<scale proportions="width" width="40"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</image></pre>
|
|
|
|
<p>Same as above but stores the result in <samp>dest</samp>.</p>
|
2003-04-16 12:44:44 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2009-08-25 13:52:17 +00:00
|
|
|
<image srcdir="src" destdir="dest" includes="*.png">
|
|
|
|
<scale proportions="width" width="40"/>
|
|
|
|
<globmapper from="*" to="scaled-*"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</image></pre>
|
|
|
|
<p>Same as above but stores the resulting file names will be prefixed by <samp>scaled-</samp>.</p>
|
2009-08-25 13:52:17 +00:00
|
|
|
|
2003-04-16 12:44:44 +00:00
|
|
|
</body>
|
|
|
|
</html>
|