ICAT Documentation

Name:

icat - HTML Image Cataloging perl script by Phil Harvey

Description:

Tool for building hierarchical HTML catalogs of JPG and GIF images

Synopsis:

icat [OPTION] DIR

Command-line Arguments:

-_ (--flat_dir) use flat directory structure for thumbnail images -% (--show_progress) print progress in % -a (--auto_rotate) enable auto-rotation for next download directory -b TAG (--body_tag) use specified html body tag (both frames) -c (--show_comments) show image file comments -d IN OUT (--download) input/output dirs for downloading pictures (note 4) -e (--no_exact_size) do not force small image to exact size -f (--force_overwrite)force icat to overwrite unrecognized html files -g (--ignore_state) ignore state file (icat.state) if it exists -h (--help) show this help -i TAG (--image_body_tag) use specified html body tag (image frame only) -j (--jpg_from_raw) extract JPG from RAW file if JPG doesn't exist -k (--clean_raw) remove JPG from RAW after extracting it -l (--local) create local.html files for local browsing -m (--rebuild_medium) regenerate medium images, even if they already exist -n (--no_recursion) no recursion into subdirectories -o DIR (--omit) omit cataloging directories with specified name -p URL (--parent_url) specify parent URL for root image directory -q (--no_square) disable square thumbnail images -r (--remove_exif) remove EXIF information from generated JPG images -s (--rebuild_small) regenerate small images, even if they already exist -t (--trash) use specified directory for 'rmpic' trash -v (--verbose) enable verbose mode -x (--show_extension) show file extensions in image label -w (--write_state) write state file to speed rebuilding of large catalogs -y FMT (--date_format) specify format for EXIF dates (see strftime manpage) -z (--strict_sort) do not sort thumbnails by size. Retain strict order -A W C (--frame) frame picture with specified width (W) and html color (C) -B TEXT (--back_text) use specified html text for Back link -D TEXT (--dummy_text) html text for dummy link (where no Prev or Next exists) -E TAG (--exif) display specified exif tag information -F TEXT (--footer) html text for page footer -H TEXT (--dir_header) html text for header of page with no images -I TEXT (--image_header) html text for header of page with with images -J JAVA (--javascript) additional java script for document head ["$java"] -L NPIX (--small_long) long dimension of small thumbnail image [$small_long] -M NPIX (--medium_size) maximum dimension of medium image [$med_width] -N TEXT (--next_text) use specified html text for Next link -O STR (--only) process only directory names containing specified string -P TEXT (--prev_text) use specified html text for Prev link -R EXT (--raw) extension for camera raw files [] -S NPIX (--small_short) short dimension of small thumbnail image [$small_short] -T TEXT (--title) title for image catalog ["$title"] -V (--save_preview) save preview image in 'preview' directory for downloads -W NPIX (--frame_width) width of thumbnail frame [$frame_width] -1 FILE (--wav_file) image for WAV file thumbnail -2 FILE (--mov_file) image for MOV and AVI file thumbnail (--tags_from_raw) copy all tags from raw image to extracted jpg

Defaults:

-b "<body bgcolor='#663333' text='#ffffff' link='#ffff00' vlink='#77ff77' alink='#77ff77'>" -i "<body bgcolor='#006633' text='#ffffff' link='#ffff00' vlink='#77ff77' alink='#77ff77'>" -B "><b><<-Back</b>" -P "><b><--Prev</b>" -N "><b>Next--></b>" -D "" -H "<font size='+1'>No Images in this directory</font><p>(Current dir is images/_SUBDIR_)" -I "Click on any small image to enlarge" -F ""

Examples:

Notes:

  1. You must have ExifTool installed to use any of the EXIF options (--download, --exif, --jpg_from_raw or --save_preview).

  2. Multiple E (--exif) options may be specified. See the ExifTool documentation for details about the tag names which can be used with the E option.

  3. The --download output directory may contain '%y', '%m', and '%d' tokens for the year, month and day of the picture. Input subdirectories are scanned recursively.

  4. Multiple --frame options may be used to create more elaborate frames. For instance, the following command will create a black 2-pixel frame within a white 8-pixel frame:
        icat --frame 2 #000000 --frame 8 #ffffff
  5. The B,P and N options (--back_text, --prev_text and --next_text) must close out the link anchor with a ">". This allows additional anchor specifications to be inserted if required.

  6. The text for the H, I and F options (--dir_header, --image_header and --footer) should not contain double quotes. (Use single quotes instead.) There are some special codes that may be used in the text:
        _SUBDIR_ - gives the current sub-directory name
        _DATE_   - date of last changed image file or subdirectory
    
  7. The following special string may be used in the B, P, N, D and J commands:
        _RELDIR_ - the location of the base directory relative to each subdirectory
    
  8. By default, the thumbnail images are generated in parallel directory trees inside "small" and "medium" directories of the root directory being cataloged. If the "-_" command-line option is specfied, thumbnails are instead placed in "small" and "medium" directories inside each cataloged subdirectory.

    ie)

    Hierarchical thumbnail directory structure (no "-_" option):

             Root
                \------- Images1
                 \------ Images2
                  \----- small
                   \         \---- Images1
                    \         `--- Images2
                     `-- medium
                             \---- Images1
                              `--- Images2
    
    Flat thumbnail directory structure (with "-_" option):
             Root
                \------- Images1
                 \           \---- small
                  \           `--- medium
                   `---- Images2
                             \---- small
                              `--- medium
    
  9. Some digital cameras add an EXIF block to their jpeg images. This block can add 12 kB to the size of a small thumbnail image, which otherwise would normally be about 2 kB. The "-r" option allows you to remove this unnecessary data from generated images so they load much faster when viewing a catalog across a network.

Special Files:

  1. If a file named "image.list" is found in a directory, then the images in this file are displayed (in the same order as in the file). Each line in image.list contains a filename, followed by an optional comment after a double-slash (//). A blank line in the file causes subsequent images to begin on a new line. If a comment exists, it is displayed even if the -c switch isn't specified.

  2. If a file named "icat_comment.txt" exists in any directory, the text found in the file is placed below the images in the right frame when the directory is opened.

  3. If a file named "icat_top_comment.txt" exists in any directory, the text from this file is placed at the top of the image frame.

  4. If a file named "icat.args" is found in the root directory being imaged, the lines from the file are added to the command-line arguments. This is the only way to use arguments when running under Classic MacOS. In this file, you can use quoted arguments. Also a "\" can be used at the end of a line to continue on the next line. As an example, the icat.args file used to generate this catalog has been included with icat.

  5. If a file named "sort.by" exists in a directory, it specifies the sort order for that directory. This is a text file that contains two lines. Each line may contain either the word "name" to sort by filename, "numbers" to sort by filename with numbers after letters, or "date" to sort by file creation date. The first line specifies the sort order for the current directory, and the second line (if it exists) specifies the sort order for all subdirectories. Add the word "reverse" before the sort type (separated by a space) to reverse the sort order. ie) If the file "sort.by" is:
     
        name
        reverse date
    
    then the current directory is sorted by name, and all subdirectories are sorted by reverse date.

  6. If the -w (write state) option is used, icat writes a file named "icat.state" to each directory. This file contains information about images, image sizes, and subdirectories, and is used to speed subsequent cataloging of the same directory.

Revision History

  03/07/01 - PH Created.
  04/09/01 - PH Added Next/Prev links to image frame.
  04/11/01 - PH Added optional comment to image.list file.
  04/17/01 - PH Fixed bug with spaces in prev/next dir name.
  04/24/01 - PH Changed directory structure and added _RELDIR_.
  04/25/01 - PH Modified to work on a MacOS too, and added capability
                to read arguments from 'icat.args'.
  04/27/01 - PH Added ImageInfo(), so now 'hu' is not required.
  05/06/01 - PH Added ability to specify relative path in image.list.
  05/10/01 - PH Added _RELDIR_ support to -J option.
  06/04/01 - PH Added icat_top_comment.txt feature.
  06/05/01 - PH Added -f option and check before overwriting a file.
  06/06/01 - PH Put semicolon after "&#39" substitution.
  08/10/01 - PH Added "sort.by" file.
  09/10/01 - PH Additions to "sort.by" file.
  10/08/01 - PH Added AppleScript in MacOS version to scale images
                using GraphicConverter.
  10/11/01 - PH Added "-_" option to specify flat thumbnail directory
                structure instead of the default hierarchical scheme.
                Also added "-M", "-S", "-L" and "-W" options.
  10/18/01 - PH Changed to write temporary files then rename when
                complete to allow cataloging active web pages.
  10/31/01 - PH Added doc.open() before writing to new document.
  12/17/01 - PH Added state file option to speed rebuilding of large
                catalogs (and -w and -g options).
  01/30/02 - PH Read icat.args from dir specified on command line.
                Added support for MacOS X (now auto-sense line
                terminator for input text files).
  02/01/02 - PH Added -r option to remove EXIF block from generated
                jpeg images.
  03/09/02 - PH Added -% option
  03/31/02 - PH Added David Purdie mods & long command line args
  04/30/02 - PH Fixed minor problem with spaces in quoted strings
                for arguments read from file
  06/11/02 - PH Put modification history back into script file
  06/12/02 - PH Fixed a couple of minor HTML formatting problems
  08/02/02 - PH Fixed bug in CleanJPG()
  08/25/03 - PH Changed to show pictures in proper order (regardless
                of tall or wide) when using right/left buttons.
  09/29/03 - PH Display large file sizes in MB
  10/20/03 - PH Speed up CleanJpg() routine
  11/03/03 - PH Add handling of _JFR and raw files
  11/09/03 - PH Look for raw file for all JPG files
  11/10/03 - PH CleanJpg() now removes all application markers
  12/09/03 - PH Added --jpg_from_raw option
  12/10/03 - PH Added automatic lossless rotation to jpg_from_raw.
                Also sets proper date/time for raw and jfr files.
  12/17/03 - PH Added ability to display EXIF information
  12/24/03 - PH Added download and autorotate options
  12/30/03 - PH Added handling of preview images.
  01/03/04 - PH Only download JPG and raw files
  01/06/04 - PH Use binmode to write JpgFromRaw and Preview files.
  01/07/04 - PH Added --frame option.
  01/13/04 - PH Added --date_format option
  01/19/04 - PH Added ability to remove JPG from RAW file (--clean_raw)
  02/15/04 - PH Update for new ExifTool API
  02/23/04 - PH Move ExifTool to Image::ExifTool
  03/01/04 - PH Change ExifTool options names
  03/31/04 - PH GetDescription() must be called with ExifTool object
  05/03/04 - PH Changed &#34 to \" in icat.args button mouseovers
  10/07/04 - PH Set ExifTool Duplicates option to zero
  03/12/05 - PH Update because ExifTool now returns binary data as reference
  06/19/05 - PH Don't save prevew if it is smaller than medium image
  08/21/05 - PH Also download MOV and WAV files
  09/16/05 - PH Improved handling of failed 'convert' commands
  05/25/06 - PH Use frame target instead of JavaScript when opening big image
                (makes downloads easier and maybe avoids popup squashing problem)
  01/04/07 - PH Added tooltips
  02/11/07 - PH Added ability to use multiple -raw options
  05/20/07 - PH Added -O (--only) option
  09/02/07 - PH Added support for AVI movies and download THM images
  10/30/07 - PH Added full support for PEF images
  11/14/07 - PH Added --tags_from_raw option
  11/19/07 - PH Fixed a couple of things which caused warnings in Safari debugger
  01/01/09 - PH Document --only and change logic
  05/03/09 - PH Get tag from JPG instead of RAW if --tags_from_raw is used
  11/18/10 - PH Use Copy1:PreviewImage if no JpgFromRaw available
  07/24/12 - PH Added google maps link for GPSPosition
  08/07/12 - PH Set Orientation to Normal after rotating JpgFromRaw
  08/18/12 - PH Added MP4,MTS and M2TS to video file types
  02/25/16 - PH Added support for left/right keys
  11/20/17 - PH Added support for PNG images
  07/09/18 - PH Added support for hidden directory
  02/08/19 - PH Use THM thumbnails for video
  09/26/19 - PH Only update list and index files if they changed
  11/29/19 - PH Write local.html files for local viewing

Known Potential Problems

It is possible to break the generated html if you are using the "-c" option to show image comments if a comment contains some really funny characters. Obvious problem characters are less than (<), ampersand (&) and double quotes ("). Newline (\n) and carriage return (\r) are translated so they don't cause problems, but there are possibly some other characters that could still cause grief.

Similarly, file names that contain funny characters may cause problems. Spaces ( ) and single quotes (') are converted so they are OK, but double quotes ("), forward slashes (/), and possibly some other funny characters may still cause some problems.

ICAT calls the Unix "convert" utility or the Classic MacOS application "GraphicConverter PPC" to resize the images for thumbnails. It can still be used on non-Unix/Mac systems, but on these systems the thumbnail images must be generated manually if "convert" is not available. "convert" may be obtained for OS X by installing the imagemagick package (using Fink, this is done by typing "fink install imagemagick").

On Classic MacOS, the script may fail if GraphicConverter isn't allocated enough memory to resize the images. If this happens, try increasing the application memory size for GraphicConverter.


Credits

ICAT was written by Phil Harvey.

The image size routines in ICAT are based on the very useful WWWis utilities by Alex Knowles.

Thanks to Hans Munthe-Kaas for submitting a bug fix for a problem with creating directories in OS X.

Thanks to David Purdie for adapting ICAT for Windows, and for writing the README.WINDOWS.

Thanks to Ralph Bradley for pointing out some HTML formatting problems.


Questions/comments can be directed to philharvey66#gmail.com