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.7 KiB

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