You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

image.html 7.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css"/>
  5. <title>Image Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="image">Image</a></h2>
  9. <h3>Description</h3>
  10. <p>Applies a chain of image operations on a set of files.</p>
  11. <p>Requires Java Advanced Image API from Sun.</p>
  12. <h5>Overview of used datatypes</h5>
  13. <img src="image-classdiagram.gif" border="0" alt="Class-Diagram">
  14. <h3>Parameters</h3>
  15. <table border="1" cellpadding="2" cellspacing="0">
  16. <tr>
  17. <td valign="top"><b>Attribute</b></td>
  18. <td valign="top"><b>Description</b></td>
  19. <td align="center" valign="top"><b>Required</b></td>
  20. </tr>
  21. <tr>
  22. <td valign="top"> failonerror </td>
  23. <td valign="top"> Boolean value. If false, note errors to the output but keep going. </td>
  24. <td align="center"> no (defaults to <i>true</i>) </td>
  25. </tr>
  26. <tr>
  27. <td valign="top"> srcdir </td>
  28. <td valign="top"> Directory containing the images. </td>
  29. <td align="center"> yes, unless nested fileset is used </td>
  30. </tr>
  31. <tr>
  32. <td valign="top"> encoding </td>
  33. <td valign="top"> Image encoding type. <br>
  34. Valid (caseinsensitive) are: jpg, jpeg, tif, tiff
  35. </td>
  36. <td align="center"> no (defaults to <i>JPEG</i>) </td>
  37. </tr>
  38. <tr>
  39. <td valign="top"> overwrite </td>
  40. <td valign="top"> Boolean value. Sets whether or not to overwrite
  41. a file if there is naming conflict.
  42. </td>
  43. <td align="center"> no (defaults to <i>false</i>) </td>
  44. </tr>
  45. <tr>
  46. <td valign="top"> gc </td>
  47. <td valign="top"> Boolean value. Enables garbage collection after
  48. each image processed.
  49. </td>
  50. <td align="center"> no (defaults to <i>false</i>) </td>
  51. </tr>
  52. <tr>
  53. <td valign="top"> destdir </td>
  54. <td valign="top"> Directory where the result images are stored. </td>
  55. <td align="center"> no (defaults to value of <i>srcdir</i>) </td>
  56. </tr>
  57. <!-- attributes inherited from MatchingTask -->
  58. <tr>
  59. <td valign="top">includes</td>
  60. <td valign="top">comma- or space-separated list of patterns of files that must be
  61. included. All files are included when omitted.</td>
  62. <td valign="top" align="center">No</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">includesfile</td>
  66. <td valign="top">the name of a file. Each line of this file is
  67. taken to be an include pattern</td>
  68. <td valign="top" align="center">No</td>
  69. </tr>
  70. <tr>
  71. <td valign="top"> excludes</td>
  72. <td valign="top">comma- or space-separated list of patterns of files that must be
  73. excluded. No files (except default excludes) are excluded when omitted.</td>
  74. <td valign="top" align="center">No</td>
  75. </tr>
  76. <tr>
  77. <td valign="top">excludesfile</td>
  78. <td valign="top">the name of a file. Each line of this file is
  79. taken to be an exclude pattern</td>
  80. <td valign="top" align="center">No</td>
  81. </tr>
  82. <tr>
  83. <td valign="top">defaultexcludes</td>
  84. <td valign="top">indicates whether default excludes should be used or not
  85. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  86. <td valign="top" align="center">No</td>
  87. </tr>
  88. <tr>
  89. <td valign="top"> caseSensitive </td>
  90. <td valign="top"> Boolean value. Sets case sensitivity of the file system. </td>
  91. <td align="center"> no (defaults to <i>false</i>) </td>
  92. </tr>
  93. <tr>
  94. <td valign="top"> followSymlinks </td>
  95. <td valign="top"> Boolean value. Sets whether or not symbolic links should be followed. </td>
  96. <td align="center"> no (defaults to <i>true</i>) </td>
  97. </tr>
  98. </table>
  99. <h3>Parameters specified as nested elements</h3>
  100. <p>This task forms an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and
  101. supports all attributes of <code>&lt;fileset&gt;</code> as well as the
  102. nested <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  103. <code>&lt;patternset&gt;</code> elements.</p>
  104. <h4>ImageOperation</h4>
  105. <p>Adds an ImageOperation to chain.</p>
  106. <h5>Nested Elements</h5>
  107. ImageOperation can handle nested Rotate, Draw, Rectangle, Text and Scale objects.
  108. <h4>Rotate</h4>
  109. <p>Adds a Rotate ImageOperation to chain.</p>
  110. <h5>Parameters</h5>
  111. <table border="1" cellpadding="2" cellspacing="0">
  112. <tr>
  113. <td valign="top"><b>Attribute</b></td>
  114. <td valign="top"><b>Description</b></td>
  115. <td align="center" valign="top"><b>Required</b></td>
  116. </tr>
  117. <tr>
  118. <td valign="top"> angle </td>
  119. <td valign="top"> Float value. Sets the angle of rotation in degrees. </td>
  120. <td align="center"> no (defaults to <i>0.0F</i>) </td>
  121. </tr>
  122. </table>
  123. <h4>Scale</h4>
  124. <p>Adds a Scale ImageOperation to chain.</p>
  125. <h5>Parameters</h5>
  126. <table border="1" cellpadding="2" cellspacing="0">
  127. <tr>
  128. <td valign="top"><b>Attribute</b></td>
  129. <td valign="top"><b>Description</b></td>
  130. <td align="center" valign="top"><b>Required</b></td>
  131. </tr>
  132. <td valign="top"> proportions </td>
  133. <td valign="top"> Sets which dimension to control proportions from. Valid values are:<ul>
  134. <li>&quot;ignore&quot; - treat the dimensions independently.</li>
  135. <li>&quot;height&quot; - keep proportions based on the width.</li>
  136. <li>&quot;width&quot; - keep proportions based on the height.</li>
  137. <li>&quot;cover&quot; - keep proportions and fit in the supplied dimensions.</li>
  138. <li>&quot;fit&quot; - keep proportions and cover the supplied dimensions.</li>
  139. </ul></td>
  140. <td align="center"> no (defaults to <i>ignore</i>) </td>
  141. <tr>
  142. <td valign="top"> width </td>
  143. <td valign="top"> Sets the width of the image, either as an integer or a %. </td>
  144. <!-- todo: if integer, what kind? cm, px, inches, ... -->
  145. <td align="center"> no (defaults to <i>100%</i>) </td>
  146. </tr>
  147. <tr>
  148. <td valign="top"> height </td>
  149. <td valign="top"> Sets the height of the image, either as an integer or a %. </td>
  150. <!-- todo: if integer, what kind? cm, px, inches, ... -->
  151. <td align="center"> no (defaults to <i>100%</i>) </td>
  152. </tr>
  153. </table>
  154. <h4>Draw</h4>
  155. <p>Adds a Draw ImageOperation to chain. DrawOperation DataType objects can be
  156. nested inside the Draw object.</p>
  157. <h5>Parameters</h5>
  158. <table border="1" cellpadding="2" cellspacing="0">
  159. <tr>
  160. <td valign="top"><b>Attribute</b></td>
  161. <td valign="top"><b>Description</b></td>
  162. <td align="center" valign="top"><b>Required</b></td>
  163. </tr>
  164. <tr>
  165. <td valign="top"> xloc </td>
  166. <td valign="top"> X-Position where to draw nested image elements. </td>
  167. <td align="center"> no (defaults to <i>0</i>) </td>
  168. </tr>
  169. <tr>
  170. <td valign="top"> yloc </td>
  171. <td valign="top"> Y-Position where to draw nested image elements. </td>
  172. <td align="center"> no (defaults to <i>0</i>) </td>
  173. </tr>
  174. </table>
  175. <h3>Examples</h3>
  176. <blockquote><pre>
  177. &nbsp;&lt;image destdir="samples/low" overwrite="yes"&gt;
  178. &nbsp;&nbsp;&nbsp;&nbsp; &lt;fileset dir="samples/full"&gt;
  179. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;include name="**/*.jpg"/&gt;
  180. &nbsp;&nbsp;&nbsp;&nbsp; &lt;/fileset&gt;
  181. &nbsp;&nbsp;&nbsp;&nbsp; &lt;scale width="160" height="160" proportions="fit"/&gt;
  182. &nbsp;&lt;/image&gt;
  183. </pre></blockquote>
  184. <p>Create thumbnails of my images and make sure they all fit within the 160x160 size whether the
  185. image is portrait or landscape.</p>
  186. <blockquote><pre>
  187. &lt;image srcdir="src" includes="*.png"&gt;
  188. &lt;scale proportions="width" width="40"/&gt;
  189. &lt;/image&gt;
  190. </pre></blockquote>
  191. <p>Creates a thumbnail for all PNG-files in <i>src</i> in the size of 40 pixel keeping the proportions
  192. and stores the <i>src</i>.</p>
  193. <blockquote><pre>
  194. &lt;image srcdir="src" destdir="dest" includes="*.png"&gt;
  195. &lt;scale proportions="width" width="40"/&gt;
  196. &lt;/image&gt;
  197. </pre></blockquote>
  198. <p>Same as above but stores the result in <i>dest</i>.</p>
  199. <blockquote><pre>
  200. </pre></blockquote>
  201. <hr>
  202. <p align="center">Copyright &copy; 2003,2005 Apache Software
  203. Foundation. All rights Reserved.</p>
  204. </body>
  205. </html>