ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <anto...@antbuild.com>
Subject Re: [PATCH] Image scaling
Date Thu, 21 Aug 2003 18:08:09 GMT
Rob :
can you please create a bugzilla report with your patch ?
I could not read you attachment anyway.
Also include in your patch the docu if possible.
Thanks in advance.
Antoine
----- Original Message -----
From: "Rob Oxspring" <roxspring@imapmail.org>
To: <dev@ant.apache.org>
Sent: Thursday, August 21, 2003 7:58 PM
Subject: [PATCH] Image scaling


First up, sorry for no unit tests - just doing enough to get by for now :)

Anyway, I was using the image task to create thumbnails and couldn't figure
out how to keep proportions of an image but keep it within a fixed size.  My
solution was to change the keepproportions attribute to be a little
cleverer.  The keepproportions attribute is no more and has been replaced by
the proportions attribute has been added with the following features:

proportions="ignore" - treat the dimensions independantly
(==keepproportions="false" and is default)
proportions="width" - keep proportions based on the width
(==keepproportions="true")
proportions="height" - keep proportions based on the height
proportions="fit" - keep proportions and fit in the supplied dimensions
proportions="cover" - keep proportions and cover the supplied dimensions

So for example I can use the following to create thumbnails of my images and
make sure they all fit within the 160x160 size whether the image is portrait
or landscape.

<image destdir="samples/low" overwrite="yes">
    <fileset dir="samples/full">
        <filename name="**/*.jpg"/>
    </fileset>
    <scale width="160" height="160" proportions="fit"/>
</image>

Hope that's helpful to others,

Rob




----------------------------------------------------------------------------
----


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



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


Mime
View raw message