Automatic Picture Resizing Technology

Continuing our policy of releasing software so that other people can make all the money we bring you APRT. Only joking it a simple idea but will save time if you are using Linux and if you use say Word or Frontpage will give you an immediate starting point so you can immediately get going. We still use conventional rather than digital cameras largely because of historical reasons but also you never know someone may want to offer you a lot of money for one and it would be a shame to have to sacrifice quality and we like to hang them on our walls and as I look up the 12:23 departure to Utrecht Centraal is just leaving Den Dolder station in the snow.

The only problem is that the programs do require Awk and The GNU Image program rather than the more mainstream Paintshop or Photoshop and Perl. We would like to port all our software to the Windows platform but as this would require a significant outlay of around EUR 1500 (don't worry the currency conversion will be back soon.) we would like a sponsor. There is a GIMP for Windows but we cannot vouch for it but check

Gimp.Org

for more information.

Don't worry if you get lost here but I thought it appropriate to give some background. The GIMP allows tasks to be automated via a programming language known as Script-FU - a "dialect"of LISP the list processing language that has more or less fallen into disuse. The programming community either love or loath it and it does take a bit of getting used to so as we had a need to get something out quickly we decided to automatically generate an HTML page from a list of image files, such as JPG from a given list file.

In the dialogue box (shown above) information such as maximum image size and list and out put filenames so all you have to do is write the jokes / historical facts about ancient archeological sites.

Those in the accountancy profession how have problems in this department are advised to look at the /usr/bin/fourtune or just fortune program which may be available somewhere which generates humourous Chinese style proverbs though of course they may not match the pictures and may be so profound the cause offence to some. See later for how to insert these automatically without resort to cut and paste.

Time to download the script.

Threshold changed to 604 / 450 for consistency purposes. Change as you see fit.


image_sizes.scm (2359 bytes)

On Linux / Unix copy the script file to


$HOME/.gimp-1.1/scripts

Then start The GIMP in the usual way. Check that the scripts has been by selecting the ImageSizes menu option to be found under Xtns|Script-Fu|Utils in the small window containing the "toolbox".

The script requires a file containing the names of the image files in full such as the following

/home/ndbo/wembley.jpg
/home/ndbo/nl.jpg
/home/ndbo/ducks.jpg
/home/ndbo/tshirt2.jpg
/home/ndbo/001_1.jpg
/home/ndbo/002_2.jpg
/home/ndbo/marble.jpg
/home/ndbo/card.jpg
/home/ndbo/tshirt3.jpg
/home/ndbo/latour.jpg
/home/ndbo/alphabet.jpg

This can be generated automatically by something like

ls $HOME/*.jpg > filelist

Note that the files will be in alphabetical order. Some photo CDs name the files in reverse order so to get the list in the order in which the photos were taken for this instance type.

ls -r $HOME/*.jpg > filelist

As you probably want to compress and edit the photos a trick that will work on Windows is to edit and save the images in the order that they were taken then list them in time order. See Help (DIR) in a Command Window (Dos Box) for further information. You can write the output of a dir command to a file as in Linux/Unix.

DIR *.JPG > filelist

though with the right options you may be able to get your list looking like the Unix one above.

Both the filenames in the box should be typed in full i.e. along with their directories.

The default maximum image size is 604x450 pixels to maintain consistency with the earlier stories on the site but you can change it to suit small screens or projectors. NDBO Format checkbox makes the format of the HTML page the same as that used on the site. Note that the background is set to ../marble.jpg so if you are combining the images into a zip file for instance it far simpler to copy marble.jpg into the image directory the change the line.

<body background="../marble.jpg">

to just

<body background="marble.jpg">

or use your own background image file.

All being well an HTML page should be written to the output file given and obviously you can check this by loading a local file into your browser.

And finally if like everyone else you are stuck what to write try the following awk program on your newly generated HTML file.

{
   print $0;
   if (index ($0, "img") > 0) {
      print "<p>"
      system ("fortune");
      print "</p>"
   }
}

Save it to say fortune.awk then run using something like

awk -f fortune.awk test.htm > test2.htm

On both Linix/Unix and Dos.

Where test.htm and test2.htm are the input and output files respectively.

As we said in the early days of the site the HTML files and images can be combined into a zip file and emailed so that anyone can read them whatever hardware/software they have installed on their computer.

Hosted by www.Geocities.ws

1