ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Z Grey <>
Subject ANT Image Manipulation
Date Mon, 15 Jul 2002 21:39:57 GMT


    Here's what I've got so far for the image manipulation tasks. 
 Before I dish out the high-level description of whats in the zip, I 
want to note that it does not have support for depend sets only because 
this past week has been extremely hectic.  I have added in "thumbnail" 
support via a "scale" task, as well as support for all the other image 
codecs that JAI supports (JPEG, PNG, BMP, PNM, etc).  I also added in 
the Apache license and javadoc descriptions which are incomplete for a 
couple files (I'll update those ASAP).  Here is a description of the 

    * Relevent packages for this are:  and  I chose optional for
      the obvious reasons
    * There is only one "Task" object called Image which extends
    * All of the image manipulations are represented as nested elements
      under the Image task and extend from the ImageOperation class
    * The ImageOperation class extends DataType
    * There are two types of ImageOperations:  TransformOperation and
    * TransformOperations are any image manipulations that require an
      image buffer to execute  (i.e. Scale needs an image buffer to
      scale and it returns the modified buffer)
    * DrawOperations are image manipulations that only return an image
      buffer (i.e. Ellipse needs only to create an image buffer to draw
      a circle in and return that buffer)

The resulting ANT XML looks like this:

        <image includes="*.jpg" srcdir="${image.dir}" overwrite="true">
            <scale width="150" height="110%"/>  <!--  Scale the Width to 
precisely 150 Pixels and increase the height by 10% -->
            <draw xloc="0" yloc="40">
                <text string="ANT for Image Manipulation" font="Arial" 
point="16" color="white"/>

Current ImageOperations that I have written are:

    * Rotate: Rotates an image by N degrees
    * Scale: Scales an image either to a specific pixel value or percentage
    * Draw: Specifies where to draw an image passed from a DrawOperation
    * Text: Draws formatted text into the image
    * Ellipse: Draws an ellipse/circle
    * Rectangle: Draws a rectangle


    * Depends support
    * Change Scale to use attribute "size" rather than "width" and "height"
    * Add Watermark operation
    * Add AutoLevels operation plus a Levels operation which allows more
    * Add ops to add/subtract/multiply/divide by scalars and entire images
    * Maybe a method to convert from image format X to Y
    * Determine whether or not people get really annoyed from me using
      bullet points in my emails

Let me know what you guys think.  

oh yeah, to thumbnail do:

        <image includes="**.jpg" srcdir="${image.dir}" overwrite="true">
            <scale width="64" height="48"/>   <!-- Scales to 128x96 
pixels... you get the point though ;) -->


View raw message