On Tue, 28 Dec 2004 18:52:32 +1300
Andy Leach <[EMAIL PROTECTED]> wrote:
> However, totaly bending my brain out of shape this afternoon & evening
>
> are 1/ regex - I have files named things like "04122801 Andys great
> waterfall pic.jpg" - which is YYMMDD followed by a 2 digit number to
> order photos from a particular day and then a space followed by 5-30
> alpha and space characters followed by ".jpg". I believe that I have
> to pass this out to perl ( perl -e ?), sed or awk but am thoroughly
> flummoxed by how to get it into or out of those programs. I need this
> to check the filenames are valid, to rename them and to dump out the
> string to a file.
More info needed; Check for what validity?
> to fail. I am aiming for images of a specific maximum size ( 600x475
> px ) and so need to calculate which dimension it is best to base the
> resize on, the images are cropped to all sorts of sizes.
>
I think that ImageMagick will do this for you. The resize option will
take
-resize 600x475
which will make the picture fit inside this rectangle. If, however, you
want to automatically choose landscape or portrait (475x600), surely
rough maths obtaining a + or - result (<>0) will do?
One (admittedly crappy) way to truncate to integer:
echo 1234.567890|sed s/\\..*//
For rounding you have to add .5 first.
HTH
Al
--
Alasdair Tennant
Dunedin
New Zealand