Automaticly Tag RAW-TIFF with Metadata from Logbook

Problems:

1. Images and Imagemetadata are seperated.

The Images are created as RAW-TIFF File.

The Metadata is created in the Logbook App and exported as json.

Merging the Data

The exiftool inherits a feature where metadata stored in json format can be merged with an exif capable file.

exiftool -json=picture.json picture.jpg

It is also capable of merging multiple files with correct formated json containing the filename as

"FileName": "raw0001.tif",

with

exiftool.exe -json=metadata.json *

Unfortunaly the exported json from Logbook is not in an exif conform way which results in Problem 2.

Sidenote:

Export exifdata of multiple images to json:

exiftool.exe -json imagefolder/

2. Metadata is stored in a non Exif conform way

Tags and Taginformation of the Logbook-JSON file are not created with Exif standard tag names or datatypes

Compairing Logbook tags with exif Standard Values:

exif standard source: https://www.exif.org/Exif2-2.PDF

logbook source: 030_tmax_Kodak_T-MAX_400_400_Gs-1.json

Logbook Format Datatype (JSON) EXIF Format Datatype*
date %Y-%m-%dT%H:%M:S%Z String DateTimeOriginal YYYY:MM:DD HH:MM:SS ASCII
exposure_time seconds Number ExposureTime ShutterSpeedValue* Seconds SRATIONAL
exposure_time_str human readable fractional seconds String NONE NONE NONE
fnumber n where n is from f/n Number FNumber ApertureValue* n where n is from f/n RATIONAL
focal_length in mm Number FocalLength mm RATIONAL
latiude decimal degree Number GPSLatitude three RATIONAL values giving the degrees, minutes, and seconds, respectively RATIONAL
GPSLatitudeRef Indicates whether the latitude is north or south latitude. The ASCII value 'N' indicates north latitude, and 'S' is south latitude. ASCII
longitude decimal degree Number GPSLongitude three RATIONAL values giving the degrees, minutes, and seconds, respectively RATIONAL
GPSLongitudeRef Indicates whether the longitude is east or west longitude. ASCII 'E' indicates east longitude, and 'W' is west longitude. ASCII
lens_make text String Not standardized Not standardized Not standardized
lens_model text String Not standardized Not standardized Not standardized
lens_nickname text String Not standardized Not standardized Not standardized
notes text String UserComment or ImageDescription Text UNDEFINED or ASCII
shot_number integer number Number Not standardized Not standardized Not standardized

*Format

Type The following types are used in Exif:

1 = BYTE An 8-bit unsigned integer.,

2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL.,

3 = SHORT A 16-bit (2-byte) unsigned integer,

4 = LONG A 32-bit (4-byte) unsigned integer,

5 = RATIONAL Two LONGs. The first LONG is the numerator and the second LONG expresses the denominator.,

7 = UNDEFINED An 8-bit byte that can take any value depending on the field definition,

9 = SLONG A 32-bit (4-byte) signed integer (2's complement notation),

10 = SRATIONAL Two SLONGs. The first SLONG is the numerator and the second SLONG is the denominator.

*ApertureValue

The AV (Aperture Value) is an expression that tells how many stops away from f/1 an aperture is.

Since f/1 is zero distance from f/1, it has an AV of zero (0) Since f/1.4 is one stop slower than f/1, it has an AV of one (1) Since f/2 is two stops away from f/1, it has an AV of two (2) Since f/2.8 is three stops from f/1, its AV is three (3) ... and so on.

*ShutterspeedValue

Analog to AperatureValue

3. JSON Structure

Logbook creates a nested JSON where information about film, camera and an array containing the individual shot information is stored

{
  "box_iso" : 400,
  "camera_make" : "Bronica",
  "camera_model" : "Gs-1",
  "camera_nick" : "Gs-1",
  "film name" : "Kodak T-MAX 400",
  "load_date" : "2021-08-21T10:40:00Z",
  "roll_name" : "030_tmax",
  "shot_iso" : 400,
  "shots" : [
    {
      "address" : "Dahme",
      "aperture_str" : "f:5.6",
      "bellows_extension_cmp" : 0,
      "date" : "2021-08-21T10:52:26Z",
      "exposure_time" : 0.0040000000000000001,
      "exposure_time_str" : "ss: 250",
      "fnumber" : 5.5999999046325684,
      "focal_length" : 150,
      "focal_length_str" : "150mm",
      "latitude" : 52.349065039474667,
      "lens_make" : "Bronica",
      "lens_model" : "Zenzanon-Pg 150\/4",
      "lens_nickname" : "Pg 150\/4",
      "longitude" : 13.635195315743191,
      "notes" : "",
      "shot_number" : 1
    },]}

This opposes th format the exiftool fe. requieres which is a not nested redundant JSON on exp- or import

[{
  "SourceFile": "./raw0001.tif",
  "ExifToolVersion": 12.30,
  "FileName": "raw0001.tif",
  "Directory": ".",
  "FileSize": "6.7 MiB",
  "FileModifyDate": "2021:09:08 00:32:40+02:00",
  "FileAccessDate": "2021:09:11 15:52:58+02:00",
  "FileCreateDate": "2021:09:07 22:11:57+02:00",
  "FilePermissions": "-rw-rw-rw-",
  "FileType": "TIFF",
  "FileTypeExtension": "tif",
  "MIMEType": "image/tiff",
  "ExifByteOrder": "Little-endian (Intel, II)",
  "SubfileType": "Full-resolution image",
  "ImageWidth": 1520,
  "ImageHeight": 2320,
  "BitsPerSample": 16,
  "Compression": "Uncompressed",
  "PhotometricInterpretation": "BlackIsZero",
  "FillOrder": "Normal",
  "Make": "Praktica",
  "Model": "DTL-3",
},]

Solution

Write a Script for translating Logbook-Json to exif/exiftool-json

Edited by Sebastian