A collection of scripts, templates and assets to sort pictures by different photographers at different days of the same event and create a neat summary html page.
Find a file
2018-10-22 14:00:44 +02:00
assets Add license information 2018-10-11 16:51:44 +02:00
templates Gallery: Add creation time metatag 2018-10-11 16:44:03 +02:00
create-gallery.py Add execute permissions to Python scripts 2018-10-22 14:00:44 +02:00
license.txt Add license information 2018-10-11 16:51:44 +02:00
readme.md Fix readme 2018-10-11 16:54:12 +02:00
requirements.txt Add readme file and __author__ tags 2018-10-11 16:43:57 +02:00
sort-images.py Add execute permissions to Python scripts 2018-10-22 14:00:44 +02:00

Scripts for Image Gallery Creation

This is a collection of scripts, templates and assets to sort pictures by different photographers at different days of the same event and create a neat summery html page.

Prerequisites

You will probably need:

  • Python 3.5 (or newer)
  • Python packages python-xmp-toolkit, pillow and jinja2
  • Some image organizing tool like digiKam to edit metatags
  • exiftool to edit metatags
  • exiftran to rotate images

Debian/Ubuntu:

$ sudo apt install python3 python3-pip exiftool exiftran
$ pip3 install --user -r requirements.txt

Arch Linux:

$ sudo pacman -S python python-pip perl-image-exiftool fbida
$ pip3 install --user -r requirements.txt

How to

  1. Rotate images according to EXIF tags:

    $ exiftran -ai path/to/pictures/*.jpg
    
  2. Fix XMP CreateDate of pictures from cameras with unsynced clock
    Typically you can rely on the EXIF DateTimeOriginal tag to be set by cameras. Also, a lot of image viewers only display this tag. So we use it as source timestamp and update all the common timestamp tags.

    $ exiftool -overwrite_original -globalTimeShift <[-]hh:mm:ss> \
         -"DateTimeOriginal<DateTimeOriginal" -"DateTimeDigitized<DateTimeOriginal" \
         -"CreateDate<DateTimeOriginal" -"ModifyDate<DateTimeOriginal" \
         path/to/pictures/
    
  3. Add XMP Creator and Subject tags
    … e.g. by using digiKam's meta data templates and tags and explicitly writing the data as XMP back to file afterwards. Another way is to create XMP sidecar files with digiKam (or any other image organizing software) and use

    $ for i in *.jpg; do exiftool -tagsFromFile "$i.xmp" -overwrite_original -Creator -Subject "$i"; done
    

    to write the relevant data to the JPEG file.

  4. Sort images with sort-images.py

    $ make-gallery/sort-images.py source1/ source2/ source3/ target/
    

    All *.jpg files from all source directory are copied to target/yyyy-mm-dd/hhiiss-II-filename.jpg, where II are the initials of the XMP Creator's name. To move the images instead of copying, use -m, for hardlinks, use -l. To search source directories recursively, use the -r flag.

  5. Create HTML gallery with create-gallery.py

    $ make-gallery/create-gallery.py -t "Gallery title" target/
    

    This creates a directory target/gallery/ and generates thumbnail images and a HTML gallery there.

License

The Python Scripts are licensed under MIT License: Just use them however you want, but keep my name around and accept, that I'm not liable for anything.

Lightbox2 by Lokesh Dhakar is licensed under the terms of the MIT License.

jQuery by the JS Foundation and other contributors is also licensed unter the terms of the MIT License.