PageRenderTime 184ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/projects/ant-1.8.2/docs/manual/Tasks/image.html

https://gitlab.com/essere.lab.public/qualitas.class-corpus
HTML | 261 lines | 217 code | 25 blank | 19 comment | 0 complexity | 3c40e8b98a8c48168d77cdaa4041ed3e MD5 | raw file
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Image Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="image">Image</a></h2>
  23. <h3>Description</h3>
  24. <p>Applies a chain of image operations on a set of files.</p>
  25. <p>Requires Java Advanced Image API from Sun.</p>
  26. <h5>Overview of used datatypes</h5>
  27. <img src="image-classdiagram.gif" border="0" alt="Class-Diagram">
  28. <h3>Parameters</h3>
  29. <table border="1" cellpadding="2" cellspacing="0">
  30. <tr>
  31. <td valign="top"><b>Attribute</b></td>
  32. <td valign="top"><b>Description</b></td>
  33. <td align="center" valign="top"><b>Required</b></td>
  34. </tr>
  35. <tr>
  36. <td valign="top"> failonerror </td>
  37. <td valign="top"> Boolean value. If false, note errors to the output but keep going. </td>
  38. <td align="center"> no (defaults to <i>true</i>) </td>
  39. </tr>
  40. <tr>
  41. <td valign="top"> srcdir </td>
  42. <td valign="top"> Directory containing the images. </td>
  43. <td align="center"> yes, unless nested fileset is used </td>
  44. </tr>
  45. <tr>
  46. <td valign="top"> encoding </td>
  47. <td valign="top"> Image encoding type. <br>
  48. Valid (caseinsensitive) are: jpg, jpeg, tif, tiff
  49. </td>
  50. <td align="center"> no (defaults to <i>JPEG</i>) </td>
  51. </tr>
  52. <tr>
  53. <td valign="top"> overwrite </td>
  54. <td valign="top"> Boolean value. Sets whether or not to overwrite
  55. a file if there is naming conflict.
  56. </td>
  57. <td align="center"> no (defaults to <i>false</i>) </td>
  58. </tr>
  59. <tr>
  60. <td valign="top"> gc </td>
  61. <td valign="top"> Boolean value. Enables garbage collection after
  62. each image processed.
  63. </td>
  64. <td align="center"> no (defaults to <i>false</i>) </td>
  65. </tr>
  66. <tr>
  67. <td valign="top"> destdir </td>
  68. <td valign="top"> Directory where the result images are stored. </td>
  69. <td align="center"> no (defaults to value of <i>srcdir</i>) </td>
  70. </tr>
  71. <!-- attributes inherited from MatchingTask -->
  72. <tr>
  73. <td valign="top">includes</td>
  74. <td valign="top">comma- or space-separated list of patterns of files that must be
  75. included. All files are included when omitted.</td>
  76. <td valign="top" align="center">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">includesfile</td>
  80. <td valign="top">the name of a file. Each line of this file is
  81. taken to be an include pattern</td>
  82. <td valign="top" align="center">No</td>
  83. </tr>
  84. <tr>
  85. <td valign="top"> excludes</td>
  86. <td valign="top">comma- or space-separated list of patterns of files that must be
  87. excluded. No files (except default excludes) are excluded when omitted.</td>
  88. <td valign="top" align="center">No</td>
  89. </tr>
  90. <tr>
  91. <td valign="top">excludesfile</td>
  92. <td valign="top">the name of a file. Each line of this file is
  93. taken to be an exclude pattern</td>
  94. <td valign="top" align="center">No</td>
  95. </tr>
  96. <tr>
  97. <td valign="top">defaultexcludes</td>
  98. <td valign="top">indicates whether default excludes should be used or not
  99. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  100. <td valign="top" align="center">No</td>
  101. </tr>
  102. <tr>
  103. <td valign="top"> caseSensitive </td>
  104. <td valign="top"> Boolean value. Sets case sensitivity of the file system. </td>
  105. <td align="center"> no (defaults to <i>false</i>) </td>
  106. </tr>
  107. <tr>
  108. <td valign="top"> followSymlinks </td>
  109. <td valign="top"> Boolean value. Sets whether or not symbolic links should be followed. </td>
  110. <td align="center"> no (defaults to <i>true</i>) </td>
  111. </tr>
  112. </table>
  113. <h3>Parameters specified as nested elements</h3>
  114. <p>This task forms an implicit <a href="../Types/fileset.html">FileSet</a> and
  115. supports most attributes of <code>&lt;fileset&gt;</code> as well as the
  116. nested <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  117. <code>&lt;patternset&gt;</code> elements.</p>
  118. <h4>ImageOperation</h4>
  119. <p>Adds an ImageOperation to chain.</p>
  120. <h5>Nested Elements</h5>
  121. ImageOperation can handle nested Rotate, Draw, Rectangle, Text and Scale objects.
  122. <h4>Rotate</h4>
  123. <p>Adds a Rotate ImageOperation to chain.</p>
  124. <h5>Parameters</h5>
  125. <table border="1" cellpadding="2" cellspacing="0">
  126. <tr>
  127. <td valign="top"><b>Attribute</b></td>
  128. <td valign="top"><b>Description</b></td>
  129. <td align="center" valign="top"><b>Required</b></td>
  130. </tr>
  131. <tr>
  132. <td valign="top"> angle </td>
  133. <td valign="top"> Float value. Sets the angle of rotation in degrees. </td>
  134. <td align="center"> no (defaults to <i>0.0F</i>) </td>
  135. </tr>
  136. </table>
  137. <h4>Scale</h4>
  138. <p>Adds a Scale ImageOperation to chain.</p>
  139. <h5>Parameters</h5>
  140. <table border="1" cellpadding="2" cellspacing="0">
  141. <tr>
  142. <td valign="top"><b>Attribute</b></td>
  143. <td valign="top"><b>Description</b></td>
  144. <td align="center" valign="top"><b>Required</b></td>
  145. </tr>
  146. <td valign="top"> proportions </td>
  147. <td valign="top"> Sets which dimension to control proportions from. Valid values are:<ul>
  148. <li>&quot;ignore&quot; - treat the dimensions independently.</li>
  149. <li>&quot;height&quot; - keep proportions based on the width.</li>
  150. <li>&quot;width&quot; - keep proportions based on the height.</li>
  151. <li>&quot;cover&quot; - keep proportions and fit in the supplied dimensions.</li>
  152. <li>&quot;fit&quot; - keep proportions and cover the supplied dimensions.</li>
  153. </ul></td>
  154. <td align="center"> no (defaults to <i>ignore</i>) </td>
  155. <tr>
  156. <td valign="top"> width </td>
  157. <td valign="top"> Sets the width of the image, either as an integer or a %. </td>
  158. <!-- todo: if integer, what kind? cm, px, inches, ... -->
  159. <td align="center"> no (defaults to <i>100%</i>) </td>
  160. </tr>
  161. <tr>
  162. <td valign="top"> height </td>
  163. <td valign="top"> Sets the height of the image, either as an integer or a %. </td>
  164. <!-- todo: if integer, what kind? cm, px, inches, ... -->
  165. <td align="center"> no (defaults to <i>100%</i>) </td>
  166. </tr>
  167. </table>
  168. <h4>Draw</h4>
  169. <p>Adds a Draw ImageOperation to chain. DrawOperation DataType objects can be
  170. nested inside the Draw object.</p>
  171. <h5>Parameters</h5>
  172. <table border="1" cellpadding="2" cellspacing="0">
  173. <tr>
  174. <td valign="top"><b>Attribute</b></td>
  175. <td valign="top"><b>Description</b></td>
  176. <td align="center" valign="top"><b>Required</b></td>
  177. </tr>
  178. <tr>
  179. <td valign="top"> xloc </td>
  180. <td valign="top"> X-Position where to draw nested image elements. </td>
  181. <td align="center"> no (defaults to <i>0</i>) </td>
  182. </tr>
  183. <tr>
  184. <td valign="top"> yloc </td>
  185. <td valign="top"> Y-Position where to draw nested image elements. </td>
  186. <td align="center"> no (defaults to <i>0</i>) </td>
  187. </tr>
  188. </table>
  189. <h4>mapper</h4>
  190. <p><em>Since Apache Ant 1.8.0</em></p>
  191. <p>You can define filename transformations by using a
  192. nested <a href="../Types/mapper.html">mapper</a> element. The
  193. default mapper used by
  194. <code>&lt;image&gt;</code> is
  195. the <a href="../Types/mapper.html#identity-mapper">identity
  196. mapper</a>.</p>
  197. <p>You can also use a filenamemapper type in place of the mapper
  198. element.</p>
  199. <h3>Examples</h3>
  200. <blockquote><pre>
  201. &nbsp;&lt;image destdir="samples/low" overwrite="yes"&gt;
  202. &nbsp;&nbsp;&nbsp;&nbsp; &lt;fileset dir="samples/full"&gt;
  203. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;include name="**/*.jpg"/&gt;
  204. &nbsp;&nbsp;&nbsp;&nbsp; &lt;/fileset&gt;
  205. &nbsp;&nbsp;&nbsp;&nbsp; &lt;scale width="160" height="160" proportions="fit"/&gt;
  206. &nbsp;&lt;/image&gt;
  207. </pre></blockquote>
  208. <p>Create thumbnails of my images and make sure they all fit within the 160x160 size whether the
  209. image is portrait or landscape.</p>
  210. <blockquote><pre>
  211. &lt;image srcdir="src" includes="*.png"&gt;
  212. &lt;scale proportions="width" width="40"/&gt;
  213. &lt;/image&gt;
  214. </pre></blockquote>
  215. <p>Creates a thumbnail for all PNG-files in <i>src</i> in the size of 40 pixel keeping the proportions
  216. and stores the <i>src</i>.</p>
  217. <blockquote><pre>
  218. &lt;image srcdir="src" destdir="dest" includes="*.png"&gt;
  219. &lt;scale proportions="width" width="40"/&gt;
  220. &lt;/image&gt;
  221. </pre></blockquote>
  222. <p>Same as above but stores the result in <i>dest</i>.</p>
  223. <blockquote><pre>
  224. &lt;image srcdir="src" destdir="dest" includes="*.png"&gt;
  225. &lt;scale proportions="width" width="40"/&gt;
  226. &lt;globmapper from="*" to="scaled-*"/&gt;
  227. &lt;/image&gt;
  228. </pre></blockquote>
  229. <p>Same as above but stores the resulting file names will be prefixed
  230. by "scaled-".</p>
  231. <blockquote><pre>
  232. </pre></blockquote>
  233. </body>
  234. </html>