Created
June 21, 2024 20:43
-
-
Save garbast/a14421966277c9af562c6664066dcb10 to your computer and use it in GitHub Desktop.
Set creation date on export in darktable .config/darktable/luarc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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