Image Batch Processing

...Akkana

These scripts make it easy to upload large numbers of images (from a scanner or digital camera, for example) and turn them into web pages. They run on Unix systems (other restrictions as noted) though it might not be too hard to port them to other operating systems. They're written in a motley collection of csh, perl and python. You may freely use and modify these programs under the GNU Public License.

Download the whole collection: imagebatch-1.6.tar.gz.

You can also browse the latest imagebatch source on Github.

Warning! These are not really set up as a nice usable package. I'm under the impression that since there are a gazillion packages to do this, nobody's actually going to want mine except maybe as a learning tool or a starting point to write your own. If you actually are trying to use these scripts and having trouble figuring them out, please let me know. I'll be happy to (1) answer any questions, (2) write some better documentation or (3) send you the latest versions (the versions here may not always be the latest-and-greatest and may have some bugs that I've fixed on my local machine).

Requirements: You should have ImageMagick (for scaling and thumbnail drop shadows), libjpeg-progs (for jpegtran and jpegexiforient) and jhead (for cleaning up unwanted EXIF like embedded thumbnails).

Here's a sample page.

How to use

Here's a typical workflow for me, from photo upload to web page:

  1. After uploading images, I view and catalog them with my Pho image viewer, (separate, not part of this package) marking the ones that I want to put on a web page.
  2. Copy those images to another directory somewhere (leaving the originals in place) and cd there.
  3. Use rotateall to rotate anything that needs it, e.g. rotateall -right img004.jpg img007.jpg -left img011.jpg
  4. Resize everything to a reasonable size for the web, e.g. resizeall -size 600 *.jpg
  5. Run mkwebphotos, which does the rest.

The latest version of mkwebphotos creates a PHP file that handles the thumbnail page and all the individual image pages. If you don't want to use PHP, uncomment the tblimages line in mkwebphotos and it will make an index.html page.

Descriptions of the individual scripts

resizeall (python)
Rescale images to a smaller size (can also make thumbnails). It requires the imgsize script.
mkthumb (symbolic link to resizeall)
If resizeall is called as "mkthumb", it will automatically put itself in thumbnail mode, and (unless told otherwise) will generate drop shadows. Just make a link from resizeall to mkthumb.
rotateall (csh)
Rotate all the images, -left -cw -right -ccw -180 or -0. You can switch directions in midstream, e.g. rotateall -cw foo.jpg bar.jpg -ccw baz.jpg
If you have jpegtran installed, it will use that for lossless jpeg rotation.
It will remove all EXIF rotation information. To remove the EXIF rotation information without actually rotating anything, use rotateall -0
mkphplist (python)
Find images under the current directory and generate a file suitable for using showpix.php. This is faster than the Perl CGI, and more self contained, assuming you have PHP available. I'm gradually migrating.
mkwebphotos (perl)
Given a directory hierarchy containing images already sized, make thumbnails, then showpix.cgi, index.html (using showpix.cgi) and static.html (which refers to the images alone -- good for when you back up the web page to a CD and send it to your parents).
thumbpage (perl)
Make a big HTML page of thumbnails suitable for printing from a browser. Useful if you want to keep a printed archive of your photo collection.
tblimages (csh)
Take a bunch of thumbnail images (assuming that full-sized images are in the same directory) and make a web page out of them. Lots of options:
-t
uses tables instead of fancy CSS lists (4 wide by default, but you can pass -1 through -9 to change that),
-p
makes it link to PHP pages instead of just the raw images,
-c
links to CGI pages instead of PHP or raw images,
-r
makes it recurse through subdirectories looking for images,
-b
puts a border on the thumbnails (if you're not using dropshadows)
-n
doesn't add HTML headers (in case you're making several snippets to paste together),
-a
adds annotation (see thumbpage to see how that works).
filestolower (csh)
csh: Convert filenames to lower case -- Windows image processing programs are forever converting my lower-case names to upper case.
imgsize (Perl)
Print the size of an image file. Based on code adapted from the excellent wwwis program, which is indispensable for setting width and height tags in html pages.
mkstatic (sh)
Make a static.html page from index.html (e.g. to put on a CD or some other medium that can't run PHP or CGI).
gallerypage-base.php (PHP)
The PHP that does the work of generating the web pages. Put this in a subdirectory of your web site called software, or else change the path that mkphplist uses for its require.
css/gallery.css
css/gallerypic.css
css/gallery-ie.css
CSS files that make the fancy list-based gallery pages work. I'm indebted to this brunildo example and the related discussion without which I might still be stuck on 4-column wide tables (like on this sample page for what tblimages creates with the -t option).

Older files, no longer included

showpix-base.php (PHP)
PHP for showing individual images; unable to handle the thumbnail page and generally not as flexible as the newer gallerypage-base.php. The format of the image lists is the same, so if you have old image list showpix.php files that worked with showpix-base.php, you can probably just change the require line to use gallerypage-base.php instead.
showpix.pl (perl)
CGI: Display full-sized images one by one, letting you step forward and backward, and allowing a short description for each image. (There seems to be no way to tell apache not to execute this .pl file, even with a .htaccess, so I've removed the .pl.)
mkpixlist (perl)
Find images under the current directory and generate a file suitable for using showpix.cgi.

Akkana's Software
Linux Imaging
Shallowsky Home