Photo Album Generator


Run as a Java Web Start application

If you have never used this program before, read below first.

Security Warning

You may be prompted about a "Security Warning" (because I am using a self-signed certificate). To resolve this restriction you will need to go to the Control Panel in Windows (or System Preferences on Mac), open the settings for Java, go to the Security tab, and add this website (http://www.mindtrace.net) to the Exception Site List. (On a Mac, you may still have to modify other settings to get this application to run.)

Instructions

There are many existing programs to help you take your digital pictures and turn them into an online presentation organized into "albums". This is simply another such program, although the way it works may not be typical. The main aspect that may not be user-friendly to some (but I like it), is the use of an XML file to define the organization of your photo albums. However even somebody who is not familiar with XML can probably look at the example below, and get the idea fairly quickly.

Here is an example XML file:

<?xml version="1.0"?>
<collection baseInputDir="C:/MyPictures" maxIntroThumbnails="10"
  thumbnailSmallDim="80" fullSmallDim="600" title="Pictures" showExif="true" showIptc="true">

<album title="Vacation 2006">
  <inputDir dir="vacation2006" useAll="true">
  </inputDir>
</album>

<album title="Trip to the Zoo" showExif="false" showIptc="false">
  <inputDir dir="zooPart1" useAll="true" fileEndings="jpg, png">
    <pic fileName="polar_bear.jpg" rating="5" />
    <pic fileName="lion.jpg" rating="4" caption="Eating Lunch" />
    <pic fileName="tiger.jpg" caption="Nap Time" />
  </inputDir>
  <inputDir dir="zooPart2" useAll="false">
    <pic fileName="elephant.jpg" caption="Looking for peanuts">
      <exif make="Nikon" model="D80" iso="100" exifVersion="2.21"
             dateTime="2006-09-05 20:37" shutterSpeed="1/60 sec" aperture="f4"
             exposureBias="+0.33 EV" subjectDistance="50 feet"
             flash="Did not fire" focalLength="20mm" focalLength35="30mm"
             meteringMode="Multi-segment" exposureMode="Auto"
             exposureProgram="Shutter priority" />
      <note>This elephant was 5 years old.</note>
      <note>Another note.</note>
    </pic>
  </inputDir>
</album>

</collection>

The first line just says that this is an XML file. Then we define a collection of "albums". Our album collection has certain properties:

Now in this example collection there are two albums defined. The first one is quite simple. It has a title, and consists of all the pictures on your local hard drive in the directory C:/MyPictures/vacation2006 - the inputDir you define is appended to the baseInputDir for the collection to determine the directory to look in for this album's pictures.

The second album demonstrates extra syntax you can use to more clearly define your albums. fileEndings is used to limit the types of files that are used as source images for the generator. If you do not specify fileEndings, then all files with the following endings are considered source files: jpg, jpeg, png, gif, bmp. Endings are treated case-INsensitively. Currently, tiff images are not supported.

You can use pic definitions to give further information about each picture. You can specify a rating for a picture. This affects the thumbnails on the introductory page. Suppose an album has 20 pictures, you specify two of them to have a rating of 5, another two to have a rating of 4, and you leave the rest unrated. Suppose maxIntroThumbnails is set to 10. So now, the four rated pictures will be given thumbnails on the introductory page with the two pics rated 5 first followed by the two pics rated 4, and six of your other pictures will be used as well. If no pictures are rated, then the thumbnails on the intro page are simply made for the first 10 pictures in the album. (Note an unrated pic is equivilant to specifying a rating of 0.)

The pic tag also alllows you to specify a caption for each photo. However, you don't need to specify a caption if your image already has a caption embedded inside it in IPTC data (many image programs will let you edit this data). If you do specify a caption, it will override any embedded caption. (Note the IPTC data is checked for a caption even if you set showIptc="false" for the collection or album.)

Notice that for the "Trip to the Zoo" album there are two input directories. You can specify as may input directories for an album as you like. For this second inputDir here, we don't want all the images in the directory put in the album, so useAll is set to false. In this case, we must have some pic definitions, otherwise nothing will be used from this directory.

You can put an exif tag inside a pic tag to either specify exif information that is missing in the source file or to override certain values. All of the attributes of the exif tag are optional.

You can also put one or more note tags inside a pic tag. Each note will be made into a paragraph and the notes will be displayed underneath the picture (below the caption).

That's all the XML syntax for this program. So once you write your XML file, the program requires only one other piece of input. It needs to know what directory you want to use for output - everything in your input directory tree is treated as read-only - nothing there is modified. All the new generated content (images and html) are written to the output directory. Here is what the output directory structure will look like:

index.html
collection.css

/album0
  tn0.jpg
  image0.jpg
  image0.html
  frameset0.html

  tn1.jpg
  ...etc

  thumbnails.html
/album1
...etc

Once the program generates all the images and html, you can copy the output directory tree to a web server so you have your photo album collection online.

You can optionally specify an input directory to use instead of the baseInputDir defined in your XML file. The baseInputDir in the XML file is in fact optional - but if you don't specify a baseInputDir in the XML, then you must tell the program an inputDir to use.

Note that the program checks the contents of your outputDir before writing to it. If it sees that the directory contains output from a previous run of the program, it will be erased (replaced). If there are other files in the output directory that are not recognized, then the program will give you an error message and abort - this is to prevent the accidental erasure of files that may be important to you. So if you accidently pick an outputDir with other files in it (not related to this program) then the program will give you this error message.

Image scaling algorithm: How the image is scaled affects the image quality and processing speed (but the size of the generated image in bytes is roughly the same whichever algorithm you choose). I suggest you stick to either NearestNeighbor if you want fast processing, or NNAndBox if you want the images to look better (particularly the thumbnails) and are willing to wait a while. The other algorithms may make the images look even better, but they are VERY slow.

And finally, if you want to change the look of the generated album collection in terms of colors used, text style, etc., you can easily do so. All colors and stylistic properties are controlled by the style sheet in the output directory called "collection.css". You can change this file as you like. There are also some alternative stylesheets included - you can copy style1.css, or style2.css, etc. over to collection.css and see what each alternative looks like (note that one of these is used as the default collection.css). If you come up with a new stylesheet that looks nice, send it to me, and I will include it with the program distribution!

Example online photo album collection created using this program

Caching:

Known Issues:

One more thing - All the HTML generated by this program is XHTML 1.0 compliant. Adhering to the XHTML 1.0 specification makes it easier for browsers to parse the documents and makes it more likely that these pages will be rendered the same way in all browsers.

(This page is also XHTML 1.0 compliant.) Valid XHTML 1.0!