1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

DrawString Ant Task

This Ant task writes the specified text on the given BMP image.

Requires: Java 6.0 or higher

See also:

Download

DrawString-Ant-Task-1.0.0.zip

Support This Project or Flattr this

Parameters

AttributeDescriptionRequired
imagethe BMP image to write onYes
toImagethe destination imageYes
stringthe text to writeYes
xthe x coordinate of the location where the text should be written (0 is left)No, defaults is 227
ythe y coordinate of the location where the text should be written (0 is top)No, defaults is 158
rthe red component of the RGB color to useNo, defaults is 0
gthe green component of the RGB color to useNo, defaults is 0
bthe blue component of the RGB color to useNo, defaults is 0
alignhorizontal alignment; one of: left, center or rightNo, defaults is center
scaleXhorizontal scaleNo, defaults is 1.0
scaleYvertical scaleNo, defaults is 1.0
fontFamilythe font to useNo, defaults is SansSerif
fontHeightthe height of the font to useNo, defaults is 28
boldtrue if and only if to use bold font styleNo, defaults is false
italictrue if and only if to use italic font styleNo, defaults is false

Example

<taskdef resource="drawstring.properties">
    <classpath>
        <fileset dir="lib" includes="*drawString*.jar"/>
    </classpath>
</taskdef>
<drawString image="splash_template.bmp"
            toImage="splash.bmp"
            string="Hello Splash!"
            r="255" g="255" b="255"/>

writes Hello Splash! in white on splash_template.bmp an saves the result as splash.bmp