ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Z Grey <kzg...@ntplx.net>
Subject Re: ImageManip
Date Fri, 24 May 2002 15:52:45 GMT
Steve Loughran wrote:

>----- Original Message -----
>From: "Kevin Z Grey" <kzgrey@ntplx.net>
>To: "Ant Developers List" <ant-dev@jakarta.apache.org>
>Sent: Thursday, May 23, 2002 8:23 PM
>Subject: Re: ImageManip
>
>
>  
>
>>Heya,
>>
>>    I actually considered that same thing when I was looking into this.
>> What I concluded is the following:
>>
>>        - SVG is targeted at building images from the bottom up (simple
>>shapes, text, etc) for the purpose of simple, yet pretty pictures and
>>user interfaces (even animations!)
>>    
>>
>
>well, look on it as HTML crossed with postscrupt
>
>  
>
>>        - SVG is targeted at wireless (and related) devices where the
>>bandwidth is limited
>>    
>>
>
>That's one use, though the use I made of in a project last year involved
>server side rendering of photos and fonts at 1200dpi. Look at the 'when web
>services go bad' paper under http://iseran.com/
>
>  
>
>>        - SVG does not include handling of files (read/write/formats/etc)
>>    
>>
>
>handles reading just like html:
><img src="xlink:href=http://myserver/image.jpg" />
>  
>
Ok, but it still doesn't handle writing and conversion to different 
formats.  SVG should really be called Scalable Vector Graphics Display. 
 It also does not contain any kind of functionality targeting automation.
(more below)

>  
>
>>        - SVG does not include manipulation of existing image files, for
>>example, you cannot take a JPEG of a monkey and draw a circle on his
>>face... you can however create an image of a monkey using vectors, but
>>it'd be really really hard to make it look remotely realistic.
>>    
>>
>
>see above. take the jpeg. overlay the vectors, use alpha blending
>
>  
>
>>        - My project is targeting manipulation of existing images, and
>>while SVG does have a good framework for their purposes, their model is
>>pretty obfuscated (in that its overly complex)
>>    
>>
>
>I agree on the complex, think you missed some of the obvious bits of the
>spec in your rush to re-implement.
>
>  
>
>>        - SVG doesn't seem to support the chaining model, but rather
>>only allows you to draw to a single palette.
>>    
>>
>
>unsure about what that means, or how SVG relates.
>  
>
JAI allows the developer to chain multiple image operations together.

For example: load an image into memory, rotate it by 45 degrees, scale 
to 25%, store it to disk

PlanarImage image = JAI.create("fileload", "me.jpg");
float t_angle = (float) (45 * (Math.PI / 180.0F));
ParameterBlock pb = new ParameterBlock();
pb.addSource(op);
pb.add(0.0F);
pb.add(0.0F);
pb.add(t_angle);
pb.add(new InterpolationNearest());
image = JAI.create("Rotate", pb, null);
pb.add(new Float(0.25));
pb.add(new Float(0.25));
image = JAI.create("scale", pb);

Now lets say you want to draw a rectangle with text in it, then roate 
that rectangle and insert into a specific location.  This can be 
represented very elloquently in XML as a tree, and can be applied to 
multiple images:

<imagemanip includes="**/*.jpg"srcdir="../TEST_IMAGES">
   <draw xloc="150"yloc="300">
       <rotate angle="45">
           <rectangle 
width="200"height="100"fill="transparent"stroke="blue"strokewidth="2"arcwidth="20"archeight="20">


               <text string="ANT v 6.0" font="Arial" point="35" 
color="white"/>
           <rectangle>
       </rotate>
   </draw>
</imagemanip>

(more below)

>  
>
>>    Further more, my envisioning allows the user to build complexity in
>>a hierarchical form; even extend by overloading one function, and it all
>>    
>>
>>seems to fit nicely with  the ANT framework.  See where I'm coming from
>>with this? :)
>>    
>>
>
>sort of
>
Lets say you're working for a company with multiple products that all 
share the same template image for their company logo.  The marketing 
dept comes to you and insists that you do the following for each splash 
screen:

Take the template company logo image and insert a different product logo 
per product to the precise location (precise down to the pixel, and yes 
there are people who are this picky....).  Then take the resulting image 
and draw the product name, version, build # and date, and rotate that 
slighty by 5 degrees.

Are there any existing utils that allow you to do this without either 
writing a shell script or coding your own executable specific for the 
task?  I haven't been able to find one.... and I think it'd be 
incredibly useful.  Especially if a wide assortment of ANT users develop 
servlet based apps.  You can also throw some more twists to the story, 
like add a certain border, or background, alpha layer, etc to make the 
task more difficult.  Is there an existing automated solution to this?

~~K


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message