Skip to content

Instantly share code, notes, and snippets.

@garbast
Created June 21, 2024 20:43
Show Gist options
  • Save garbast/a14421966277c9af562c6664066dcb10 to your computer and use it in GitHub Desktop.
Save garbast/a14421966277c9af562c6664066dcb10 to your computer and use it in GitHub Desktop.
Set creation date on export in darktable .config/darktable/luarc
local darktable = require 'darktable'
local function set_create_date(event, image, filename, format, storage)
local pattern = '(%d+):(%d+):(%d+) (%d+):(%d+):(%d+)'
local timeToConvert = image.exif_datetime_taken
local runyear, runmonth, runday, runhour, runminute, runseconds = image.exif_datetime_taken:match(pattern)
local convertedTimestamp = os.time({year=runyear, month=runmonth, day=runday, hour=runhour, min=runminute, sec=runseconds})
local convertedDate = os.date('%Y%m%d%H%M.%S', convertedTimestamp)
os.execute('touch -t '..convertedDate..' '..filename)
end
darktable.register_event('set-create-date', 'intermediate-export-image', set_create_date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment