Alasdair Tennant wrote:

Here's a VERY rough script I wrote recently. ImageMagick is very short
on help for newbies. This method should work just as well in a Windows
script. I am working on a Tcl/Tk version (which should also work on Windows).


thanks for your script Alasdair, amazingly I am doing okay with the ImageMagick stuff. The man pages were a little useless but the ImageMagick website is good. I'm pretty happy that I have the identify and convert bits of the script sorted.

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.

2/ Floating point arithmetic - I've had a little more luck with this. I need floating point arithmetic to calculate the target width & height of the image, so I have
HEIGHT_TEST=$(echo "scale=20; $blahblah/$yada)" | bc); which works great, but I then need to turn it back into an integer. I guess this could be done with a regex ( see problem one :-/ ) , but HEIGHT_TEST=$(echo "scale=0; $HEIGHT_TEST*1" | bc); and variations seem 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.


This is proving to be a great way to learn, but my head has hit the keyboard a few times today - can someone save me from imprinting little squares on my forehead?

mtia,

Andy

Reply via email to