






Contact
|
|
img2html - Image to HTML generation tool
A shell script to generate web galleries for directories with
images.
Description
img2html is a shell script to generate a HTML gallery for
a directory with digital images.
The generated pages do not need any web server support (also they
can of course be viewed via a web server) and are therefore suitable
to be burned on a CD.
Currently the script is optimized to be used with my CANON Powershot
G1/G2. Anyway it should be easy (if necessary at all!) to adapt it to other models if this
is needed. Usually only movies (other than *.avi) need adaption,
most jpegs are handled correctly.
There are two kinds of pages: the first kind is just plain HTML
without any gimmicks, the second kind is the full featured version.
Frames, javascript and cookies are extensively used to give the
following features:
- Selection of images
- You can select your favourite images and then save or load
this selection via cookies (this is the only cookie which is
used!).
- This selection can be used to skip unwanted images while
browsing manually through the images or using the automatic
SlideShow.
- Also you can request the selected images (via mail-form of
you provider, this feature needs adaption to your needs)
- SlideShow with adjustable cycle time.
- Adding image information and comments, these can be sent (via
mail-form of your provider, this feature needs adaption to
your needs) or added by hand to the "images.js" database.
- Display of some EXIF information which is embedded in the
images.
Details
Usage: img2html.sh [-full] DIRECTORY_WITH_IMAGES
You will be asked some questions and then
all JPEGs are converted to
- a quality reduced full image with copyright notice
- a size and quality reduced preview version and
- to a very small thumbnail version.
If the appropriate tool (jhead) is
installed, the thumbnail is taken out of the EXIF header. If the
converted images are already existing, they are of course reused.
While converting the images two indexes are written. One is for the
plain HTML version, the other one is for the full featured version.
Also the plain HTML pages are generated on the fly.
If you use the command-line option "-full" the
links to the fullsize images are added. Else only the preview images
are used. You can specify a different URL for the fullsize images,
too. Only when specifying this option movies are handled!
If there are some movies (extension ".avi") and option
"-full" is specified, currently an index of the thumbnails
(taken from the corresponding ".thm" files) is written to
a separate HTML page.
Tips and Tricks
You can use jpegtran from the JPEG group to rotate your
images lossless. A somehow enhanced version (including bugfixes!) called
jpegcrop is
available from guido AT jpegclub.org.
Author
Thomas Hopfner
License
© 2001, 2002 Thomas Hopfner
This software is free of charge, but without any warranty! It might
even destroy your whole system. Of course it is tested, used by me
and I do think no harm will be done. Anyway it is recommend to make
a backup copy of your data before running this script. As I am not
sure at the moment which well known open-source license I will use
in the future, I just demand that you keep my copyright notices and
the link to the original version of img2html.sh when modifying the
source. If you include my code in any commercial or shareware project,
you have to send me a free copy of your program! Of course you have
to make clearly visible that your version is modified by you, if you
have modified it!
Requirements
This script is tested on a linux machine (RedHat), but should also run
on any kind of Unix system. Windows is not supported, anyway you can
use the free cygwin environment to
get this script running (Warning: The ImageMagick tool
convert has the same name as the Windows tool to convert
FAT to NTFS. Carefully check your path!) At least you need the following tools:
- bash Shell
- Standard GNU utils like: cat, sed, awk, find, grep, ls, head
- ImageMagick tools:
convert and mogrify for image conversion
- for EXIF extraction:
jhead
A IMHO very useful and good tool from Matthias
Wandel.
- A directory full of nice images. ;)
Except jhead all tools should be included in your standard
linux distribution.
Download and ChangeLog
Click here to download img2html.sh.
A history of changes can be found here.
Installation
Download the script and move it to a suitable location in your path
(e.g. /usr/local/bin/). It might be necessary to change the first
line in the file to match the location of your bash executable.
Edit the line with AUTHOR= to match your name if you want
this as default, also you can edit the parameters for convert in the
source code.
If you do not want to allow users of your gallery to send comments, you
need to set the variable allowcomments in images.js
database to 0.
Changes:
Thomas Hopfner, 08/2001: Started page
Thomas Hopfner, 01/2003: Updated page
|