Skip to content
Pablo Casas Estévez edited this page Dec 31, 2019 · 6 revisions

The philosophy

Script for automatic file-image pre-processing, informing the date into de file and sending them to a date/event oriented folder structure.

This script can explore one or more source folders and a destination folder, searching for images and video files, merging and storing them into the destination folder with a YYYY/YYYY-MM-DD eventname/images.jpg structure.

Group images into event's folder structure, auto-reorganization of folders without loosing event's names.
Check for new files in hot-folders and move them to the destination folder, merging them with existent ones.
Optionally:
Store a the most suitable date into the EXIF metadata by selecting the most appropriate image's date (own Exif, text retrieved from the filename or folders, last modification file attribute).
convert .png images into .jpg images with EXIF date. And convert heic images into jpg using the tifig utility.

Why do I use this script?

  1. I searched a way to manage my photos. I find lots of hostings and software that reads the EXIF metadata to sort the photographs; they are all date-sorted. But not all of my images already had this data. Actually, I had lots of them without EXIF metadata, because the were taken by scanning old paper pictures or simply they were digital photos that were created by computer (screenshots, renders and other stuff) . This photos without an EXIF date-taken metadate, usually goes to the "no date" event, messing all around.

Fortunately, I had lots of image photos in a kind of date-folder-tree structure. I used to sorting this folders in a structure like YEAR/year-month/photograph 001.jpg .... or the like. So I had the picture’s date, but I needed to insert it into the image before I could use some software to manage them.

That's what this script does. It tries to obtain the most suitable date for the image and inserts it into the file as EXIF metadata. During the process, the files are moved from one or more places to another, so you can easily follow the progress of metadatation.

  1. Sometimes I want to manage an image that someone has send me by whatsapp. Whatsapp image files does not contains EXIF metadata, but they have a date pattern as filename "Wa YYYYMMDD.jpg".
    I use this script to retrieve the date from the filename and insert it into de image.

  2. I can automatically move images from my camera's SD-Card, and from my Dropbox image's inbox folder. They will go to the destination folder and the script will merge them as they come without deleting my folder's (event) name.

  3. It was really easy to insert an approximate date on the filenames of my old scanned collection. After organize them and inform the date on the folders or filenames, I could easily insert these dates into hundreds of files as EXIF metadata and sort them on a new folder structure (in my case, they where ready to be imported by a photo manager).

How to run this script

This is a python3 script made for linux. You can run it by downloading it and running: python3 PhotodeliverII.py

The first time you run the script, it generates a config file in your home directory ~/.Photodeliver/Photodelivercfg.py
The config file has the default values. You can configure this defaults or override them by using command line options.
run this for command line help:
python3 PhotodeliverII.py --help

This script will generate a log file at the location from where it is run.

Dependencies

  • python3
  • GExiv2. for handle metadata.
  • python3-pil - Python Imaging Library (Python3). Image conversion (png to jpg)
  • tifig utility - grabbed from https://github.com/monostream/tifig
Clone this wiki locally