Compare commits
7 Commits
a9a68eaf31
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d44355aeb8 | ||
|
|
9e5a63c8ca | ||
|
|
bc308b4845 | ||
|
|
c00038b63c | ||
|
|
8509fd7ffc | ||
|
|
b0a21a457b | ||
|
|
42ae32aeda |
@@ -1,3 +1,6 @@
|
|||||||
# dtlua -- darktable lua scripts
|
# dtlua -- darktable lua scripts
|
||||||
|
|
||||||
|
`add_lens_info`: script to add manual lens info. from [[https://discuss.pixls.us/t/add-lens-information-in-darktable/45262/19|pixls.us]]
|
||||||
|
* `cr2hdr`: the `contrib/cr2hdr` script from [[https://github.com/darktable-org/lua-scripts|lua-scripts]], but with a locale fix
|
||||||
* `ext_proc`: external processing with arbitrary command
|
* `ext_proc`: external processing with arbitrary command
|
||||||
|
* `open_ooc`: open associated ooc jpegs for selected raw files
|
||||||
|
|||||||
376
add_lens_info.lua
Normal file
376
add_lens_info.lua
Normal file
@@ -0,0 +1,376 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
add_lens_info.lua - add user specifed lens information to exif_lens field
|
||||||
|
|
||||||
|
Copyright (C) 2025 Bill Ferguson <wpferguson@gmail.com>.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
add_lens_info - add user specifed lens information to exif_lens field
|
||||||
|
|
||||||
|
apply_lens_info takes user specified lens information strings and applies
|
||||||
|
them to the image database entries in darktable.
|
||||||
|
|
||||||
|
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||||
|
none
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* start script from script manager
|
||||||
|
* add lens information string and save it
|
||||||
|
* select lens information string in module
|
||||||
|
* select image(s) to apply the lens information to
|
||||||
|
* click apply lens information button, or use shortcut to apply the change
|
||||||
|
|
||||||
|
BUGS, COMMENTS, SUGGESTIONS
|
||||||
|
Bill Ferguson <wpferguson@gmail.com>
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
-- local df = require "lib/dtutils.file"
|
||||||
|
-- local ds = require "lib/dtutils.string"
|
||||||
|
-- local dtsys = require "lib/dtutils.system"
|
||||||
|
local log = require "lib/dtutils.log"
|
||||||
|
-- local debug = require "darktable.debug"
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- C O N S T A N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local MODULE <const> = "add_lens_info"
|
||||||
|
local DEFAULT_LOG_LEVEL <const> = log.warn
|
||||||
|
local TMP_DIR <const> = dt.configuration.tmp_dir
|
||||||
|
|
||||||
|
-- path separator
|
||||||
|
local PS <const> = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||||
|
|
||||||
|
-- command separator
|
||||||
|
local CS <const> = dt.configuration.running_os == "windows" and "&" or ";"
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A P I C H E C K
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", MODULE) -- choose the minimum version that contains the features you need
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- I 1 8 N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local os_path_seperator = "/"
|
||||||
|
local scriptfile = debug.getinfo( 1, "S" )
|
||||||
|
local localedir = dt.configuration.config_dir..'/lua/locale/'
|
||||||
|
if scriptfile ~= nil and scriptfile.source ~= nil then
|
||||||
|
local path = scriptfile.source:match( "[^@].*[/\\]" )
|
||||||
|
localedir = path..os_path_seperator..'locale'
|
||||||
|
end
|
||||||
|
dt.print_log( "localedir: "..localedir )
|
||||||
|
|
||||||
|
local gettext = dt.gettext
|
||||||
|
gettext.bindtextdomain(MODULE, localedir)
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
script_data.destroy = nil -- function to destory the script
|
||||||
|
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||||
|
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||||
|
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||||
|
|
||||||
|
script_data.metadata = {
|
||||||
|
name = _("add lens info"), -- visible name of script
|
||||||
|
purpose = _("add user specifed lens information to exif_lens field"), -- purpose of script
|
||||||
|
author = "Bill Ferguson <wpferguson@gmail.com>", -- your name and optionally e-mail address
|
||||||
|
help = "" -- URL to help/documentation
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- L O G L E V E L
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
log.log_level(DEFAULT_LOG_LEVEL)
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- N A M E S P A C E
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local add_lens_info = {}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- G L O B A L V A R I A B L E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
-- the lenses we know about
|
||||||
|
add_lens_info.lenses = {}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- P R E F E R E N C E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
-- lens data is stored in a string in the darktablerc file
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A L I A S E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local namespace = add_lens_info
|
||||||
|
local ali = add_lens_info
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- F U N C T I O N S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function read_lens_preferences()
|
||||||
|
local lenses = dt.preferences.read(MODULE, "lenses", "string")
|
||||||
|
if string.len(lenses) > 1 then
|
||||||
|
if string.match(lenses, ".+$.+") then
|
||||||
|
ali.lenses = du.split(lenses, '%$')
|
||||||
|
else
|
||||||
|
table.insert(ali.lenses, lenses)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_lens_preferences()
|
||||||
|
dt.preferences.write(MODULE, "lenses", "string", table.concat(ali.lenses, '$'))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_buttons_sensitive()
|
||||||
|
if #dt.gui.action_images > 0 then
|
||||||
|
ali.apply_lens_selection.sensitive = true
|
||||||
|
dt.gui.libs.image.set_sensitive(MODULE, true)
|
||||||
|
else
|
||||||
|
ali.apply_lens_selection.sensitive = false
|
||||||
|
dt.gui.libs.image.set_sensitive(MODULE, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function apply_lens_name()
|
||||||
|
local images = dt.gui.action_images
|
||||||
|
|
||||||
|
dt.print_log("image count is " .. #images)
|
||||||
|
|
||||||
|
for _, image in ipairs(images) do
|
||||||
|
image.exif_lens = ali.lenses[ali.select_lens_name.selected]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function install_module()
|
||||||
|
if not namespace.module_installed then
|
||||||
|
dt.register_lib(
|
||||||
|
MODULE, -- Module name
|
||||||
|
script_data.metadata.name, -- Visible name
|
||||||
|
true, -- expandable
|
||||||
|
false, -- resetable
|
||||||
|
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 400}}, -- containers
|
||||||
|
namespace.main_widget,
|
||||||
|
nil,-- view_enter
|
||||||
|
nil -- view_leave
|
||||||
|
)
|
||||||
|
namespace.module_installed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_combobox_choices(combobox, choice_table, selected)
|
||||||
|
local items = #combobox
|
||||||
|
local choices = #choice_table
|
||||||
|
for i, name in ipairs(choice_table) do
|
||||||
|
combobox[i] = name
|
||||||
|
end
|
||||||
|
if choices < items then
|
||||||
|
for j = items, choices + 1, -1 do
|
||||||
|
combobox[j] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
combobox.value = selected
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- U S E R I N T E R F A C E
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
ali.stack_selector = dt.new_widget("combobox"){
|
||||||
|
tooltip = "choose to add a lens or select the lens name to be applied",
|
||||||
|
selected = dt.preferences.read(MODULE, "selector", "integer") > 0 and dt.preferences.read(MODULE, "selector", "integer") or 1,
|
||||||
|
_("add new lens name"),
|
||||||
|
_("select lens name"),
|
||||||
|
changed_callback = function(this)
|
||||||
|
dt.preferences.write(MODULE, "selector", "integer", this.selected)
|
||||||
|
if ali.module_installed then
|
||||||
|
ali.stack.active = this.selected
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.lens_name = dt.new_widget("entry"){
|
||||||
|
placeholder = _("lens name/identification"),
|
||||||
|
text = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.add_lens = dt.new_widget("button"){
|
||||||
|
label = _("add new lens"),
|
||||||
|
tooltip = _("add new lens string to choices"),
|
||||||
|
clicked_callback = function(this)
|
||||||
|
table.insert(ali.lenses, ali.lens_name.text)
|
||||||
|
table.sort(ali.lenses)
|
||||||
|
local new_lens_place
|
||||||
|
for i, lens_name in ipairs(ali.lenses) do
|
||||||
|
if ali.lens_name.text == lens_name then
|
||||||
|
new_lens_place = i
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
update_combobox_choices(ali.select_lens_name, ali.lenses, new_lens_place)
|
||||||
|
ali.lens_name.text = ""
|
||||||
|
save_lens_preferences()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.add_new_lens = dt.new_widget("box"){
|
||||||
|
orientation = "vertical",
|
||||||
|
dt.new_widget("label"){ label = _("add new lens") },
|
||||||
|
ali.lens_name,
|
||||||
|
ali.add_lens
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.select_lens_name = dt.new_widget("combobox"){
|
||||||
|
tooltip = _("select lens name to apply to images"),
|
||||||
|
}
|
||||||
|
read_lens_preferences()
|
||||||
|
if #ali.lenses > 0 then
|
||||||
|
update_combobox_choices(ali.select_lens_name, ali.lenses, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
ali.apply_lens_selection = dt.new_widget("button"){
|
||||||
|
label = _("apply lens name"),
|
||||||
|
tooltip = _("apply lens name to selected images"),
|
||||||
|
sensitive = false,
|
||||||
|
clicked_callback = function(this)
|
||||||
|
apply_lens_name()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.select_lens = dt.new_widget("box"){
|
||||||
|
orientation = "vertical",
|
||||||
|
dt.new_widget("label"){ label = _("select lens name to apply") },
|
||||||
|
ali.select_lens_name,
|
||||||
|
ali.apply_lens_selection
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.stack = dt.new_widget("stack"){
|
||||||
|
ali.add_new_lens,
|
||||||
|
ali.select_lens,
|
||||||
|
active = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.stack_selector = dt.new_widget("combobox"){
|
||||||
|
tooltip = "choose to add a lens or select the lens name to be applied",
|
||||||
|
selected = dt.preferences.read(MODULE, "selector", "integer") > 0 and dt.preferences.read(MODULE, "selector", "integer") or 1,
|
||||||
|
_("add new lens name"),
|
||||||
|
_("select lens name"),
|
||||||
|
changed_callback = function(this)
|
||||||
|
dt.preferences.write(MODULE, "selector", "integer", this.selected)
|
||||||
|
if ali.module_installed then
|
||||||
|
ali.stack.active = this.selected
|
||||||
|
else
|
||||||
|
ali.stack.active = dt.preferences.read(MODULE, "selector", "integer")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
ali.main_widget = dt.new_widget("box"){
|
||||||
|
orientation = "vertical",
|
||||||
|
ali.stack_selector,
|
||||||
|
ali.stack
|
||||||
|
}
|
||||||
|
|
||||||
|
dt.gui.libs.image.register_action(MODULE, _("apply lens name"), apply_lens_name, _("apply lens name from apply lens info module to selected images"))
|
||||||
|
dt.gui.libs.image.set_sensitive(MODULE, false)
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- M A I N P R O G R A M
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
read_lens_preferences()
|
||||||
|
|
||||||
|
if dt.gui.current_view().id == "lighttable" then
|
||||||
|
install_module()
|
||||||
|
else
|
||||||
|
if not namespace.event_registered then
|
||||||
|
dt.register_event(MODULE, "view-changed",
|
||||||
|
function(event, old_view, new_view)
|
||||||
|
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||||
|
install_module()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
namespace.event_registered = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- D A R K T A B L E I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
dt.gui.libs[MODULE].visible = false
|
||||||
|
|
||||||
|
if namespace.event_registered then
|
||||||
|
dt.destroy_event(MODULE, "view-changed")
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local function restart()
|
||||||
|
dt.gui.libs[MODULE].visible = true
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
script_data.restart = restart
|
||||||
|
script_data.destroy_method = "hide"
|
||||||
|
script_data.show = restart
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- E V E N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
dt.register_event(MODULE, "shortcut",
|
||||||
|
function(event, shortcut)
|
||||||
|
apply_lens_name()
|
||||||
|
end, _("apply lens name")
|
||||||
|
)
|
||||||
|
|
||||||
|
dt.register_event(MODULE, "selection-changed",
|
||||||
|
function(event)
|
||||||
|
set_buttons_sensitive()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
return script_data
|
||||||
148
cr2hdr.lua
Normal file
148
cr2hdr.lua
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
--[[
|
||||||
|
Copyright (C) 2015 Till Theato <theato@ttill.de>.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
cr2hdr Magic Lantern Dual ISO processing.
|
||||||
|
|
||||||
|
This script automates the steps involved to process an image created
|
||||||
|
with the Magic Lantern Dual ISO module. Upon invoking the script with a
|
||||||
|
shortcut "cr2hdr" provided by Magic Lantern is run on the selected
|
||||||
|
images. The processed files are imported. They are also made group
|
||||||
|
leaders to hide the original files.
|
||||||
|
|
||||||
|
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||||
|
* cr2hdr (sources can be obtained through the Magic Lantern repository)
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* require this script from your main lua file
|
||||||
|
* trigger conversion on selected/hovered images by shortcut (set shortcut in settings dialog)
|
||||||
|
* it is also possible to have the script run after importing a collection (optin, since it is not that fast)
|
||||||
|
]]
|
||||||
|
|
||||||
|
local darktable = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", "cr2hdr")
|
||||||
|
|
||||||
|
local gettext = darktable.gettext.gettext
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext(msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- return data structure for script_manager
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
script_data.metadata = {
|
||||||
|
name = _("cr2hdr"),
|
||||||
|
purpose = _("process Magic Lantern dual ISO images"),
|
||||||
|
author = "Till Theato <theato@ttill.de>",
|
||||||
|
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/cr2hdr"
|
||||||
|
}
|
||||||
|
|
||||||
|
script_data.destroy = nil -- function to destory the script
|
||||||
|
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||||
|
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||||
|
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||||
|
|
||||||
|
local queue = {}
|
||||||
|
local processed_files = {}
|
||||||
|
local job
|
||||||
|
|
||||||
|
local function file_imported(event, image)
|
||||||
|
local filename = image.path .. "/" .. image.filename
|
||||||
|
if processed_files[filename] then
|
||||||
|
image.make_group_leader(image)
|
||||||
|
processed_files[filename] = false
|
||||||
|
else
|
||||||
|
if darktable.preferences.read("cr2hdr", "onimport", "bool") then
|
||||||
|
table.insert(queue, image)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function stop_conversion(job)
|
||||||
|
job.valid = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function convert_image(image)
|
||||||
|
if string.sub(image.filename, -3) == "CR2" then
|
||||||
|
local filename = image.path .. "/" .. image.filename
|
||||||
|
local result = darktable.control.execute( "LC_ALL=POSIX ~/bin/cr2hdr " .. filename)
|
||||||
|
local out_filename = string.gsub(filename, ".CR2", ".DNG")
|
||||||
|
local file = io.open(out_filename)
|
||||||
|
if file then
|
||||||
|
file:close()
|
||||||
|
processed_files[out_filename] = true
|
||||||
|
darktable.database.import(out_filename)
|
||||||
|
else
|
||||||
|
darktable.print_error(filename .. ": cr2hdr failed.")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
darktable.print_error(image.filename .. " is not a Canon RAW.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function convert_images()
|
||||||
|
if next(queue) == nil then return end
|
||||||
|
|
||||||
|
job = darktable.gui.create_job(_("dual ISO conversion"), true, stop_conversion)
|
||||||
|
for key,image in pairs(queue) do
|
||||||
|
if job.valid then
|
||||||
|
job.percent = (key-1)/#queue
|
||||||
|
convert_image(image)
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local success_count = 0
|
||||||
|
for _ in pairs(processed_files) do success_count = success_count + 1 end
|
||||||
|
darktable.print(string.format(_("dual ISO conversion successful on %d/%d images."), success_count, #queue))
|
||||||
|
job.valid = false
|
||||||
|
processed_files = {}
|
||||||
|
queue = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function film_imported(event, film)
|
||||||
|
if darktable.preferences.read("cr2hdr", "onimport", "bool") then
|
||||||
|
convert_images()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function convert_action_images(shortcut)
|
||||||
|
queue = darktable.gui.action_images
|
||||||
|
convert_images()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
darktable.destroy_event("cr2hdr", "shortcut")
|
||||||
|
darktable.destroy_event("cr2hdr", "post-import-image")
|
||||||
|
darktable.destroy_event("cr2hdr", "post-import-film")
|
||||||
|
end
|
||||||
|
|
||||||
|
darktable.register_event("cr2hdr", "shortcut",
|
||||||
|
convert_action_images, _("run cr2hdr (Magic Lantern DualISO converter) on selected images"))
|
||||||
|
darktable.register_event("cr2hdr", "post-import-image",
|
||||||
|
file_imported)
|
||||||
|
darktable.register_event("cr2hdr", "post-import-film",
|
||||||
|
film_imported)
|
||||||
|
|
||||||
|
darktable.preferences.register("cr2hdr", "onimport", "bool", _("invoke on import"), _("if true then cr2hdr will try to proccess every file during importing\nwarning: cr2hdr is quite slow even in figuring out on whether the file is dual ISO or not."), false)
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
|
||||||
|
return script_data
|
||||||
12
ext_proc.lua
12
ext_proc.lua
@@ -56,8 +56,18 @@ local MODULE = "ext_proc"
|
|||||||
|
|
||||||
du.check_min_api_version("7.0.0", MODULE)
|
du.check_min_api_version("7.0.0", MODULE)
|
||||||
|
|
||||||
|
-- from https://github.com/ChristianBirzer/darktable_extra_scripts/blob/main/HeliconFocus.lua
|
||||||
|
-- find locale directory:
|
||||||
|
local os_path_seperator = "/"
|
||||||
|
local scriptfile = debug.getinfo( 1, "S" )
|
||||||
|
local localedir = dt.configuration.config_dir..'/lua/locale/'
|
||||||
|
if scriptfile ~= nil and scriptfile.source ~= nil then
|
||||||
|
local path = scriptfile.source:match( "[^@].*[/\\]" )
|
||||||
|
localedir = path..os_path_seperator..'locale'
|
||||||
|
end
|
||||||
|
dt.print_log( "localedir: "..localedir )
|
||||||
|
|
||||||
local gettext = dt.gettext
|
local gettext = dt.gettext
|
||||||
local localedir = dt.configuration.config_dir .. "/lua/locale/"
|
|
||||||
gettext.bindtextdomain(MODULE, localedir)
|
gettext.bindtextdomain(MODULE, localedir)
|
||||||
|
|
||||||
local function _(msgid)
|
local function _(msgid)
|
||||||
|
|||||||
BIN
locale/de_DE/LC_MESSAGES/add_lens_info.mo
Normal file
BIN
locale/de_DE/LC_MESSAGES/add_lens_info.mo
Normal file
Binary file not shown.
66
locale/de_DE/LC_MESSAGES/add_lens_info.po
Normal file
66
locale/de_DE/LC_MESSAGES/add_lens_info.po
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2025-05-06 15:01+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:105
|
||||||
|
msgid "add lens info"
|
||||||
|
msgstr "manuelle Objektive"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:106
|
||||||
|
msgid "add user specifed lens information to exif_lens field"
|
||||||
|
msgstr "fügt dem exif_lens Feld ein vom Benutzer vorgegebenes Objektiv hinzu"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:220 add_lens_info.lua:294
|
||||||
|
msgid "add new lens name"
|
||||||
|
msgstr "Objektiv hinzufügen"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:221 add_lens_info.lua:295
|
||||||
|
msgid "select lens name"
|
||||||
|
msgstr "Objektiv auswählen"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:231
|
||||||
|
msgid "lens name/identification"
|
||||||
|
msgstr "Name und ID des Objektivs"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:236 add_lens_info.lua:256
|
||||||
|
msgid "add new lens"
|
||||||
|
msgstr "Objektiv hinzufügen"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:237
|
||||||
|
msgid "add new lens string to choices"
|
||||||
|
msgstr "Objektiv den Vorgaben hinzufügen"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:262
|
||||||
|
msgid "select lens name to apply to images"
|
||||||
|
msgstr "Objektiv auswählen"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:270 add_lens_info.lua:312 add_lens_info.lua:367
|
||||||
|
msgid "apply lens name"
|
||||||
|
msgstr "Objektiv verwenden"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:271
|
||||||
|
msgid "apply lens name to selected images"
|
||||||
|
msgstr "Objektiv auf ausgewählte Bilder anwenden"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:280
|
||||||
|
msgid "select lens name to apply"
|
||||||
|
msgstr "Objektiv wählen"
|
||||||
|
|
||||||
|
#: add_lens_info.lua:312
|
||||||
|
msgid "apply lens name from apply lens info module to selected images"
|
||||||
|
msgstr "wendet das in 'manuelle Objektive' gewählte Objektiv auf die Auswahl an"
|
||||||
BIN
locale/de_DE/LC_MESSAGES/open_ooc.mo
Normal file
BIN
locale/de_DE/LC_MESSAGES/open_ooc.mo
Normal file
Binary file not shown.
42
locale/de_DE/LC_MESSAGES/open_ooc.po
Normal file
42
locale/de_DE/LC_MESSAGES/open_ooc.po
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2025-04-10 10:55+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: open_ooc.lua:76
|
||||||
|
msgid "open ooc jpeg"
|
||||||
|
msgstr "JPG öffnen"
|
||||||
|
|
||||||
|
#: open_ooc.lua:77
|
||||||
|
msgid "open associated ooc jpegs for selected raw files"
|
||||||
|
msgstr "öffne die zu den ausgewählten RAW-Dateien gehörenden Kamera-JPGs"
|
||||||
|
|
||||||
|
#: open_ooc.lua:96
|
||||||
|
msgid "please select an image"
|
||||||
|
msgstr "kein Bild ausgewählt"
|
||||||
|
|
||||||
|
#: open_ooc.lua:111
|
||||||
|
msgid "selection empty, or no jpeg available"
|
||||||
|
msgstr "kein Bild ausgewählt oder JPG nicht vorhanden"
|
||||||
|
|
||||||
|
#: open_ooc.lua:130
|
||||||
|
msgid "open jpeg"
|
||||||
|
msgstr "JPG öffnen"
|
||||||
|
|
||||||
|
#: open_ooc.lua:132
|
||||||
|
msgid "open associated ooc jpegs for the selected raw files"
|
||||||
|
msgstr "öffne die zu den ausgewählten RAW-Dateien gehörenden Kamera-JPGs"
|
||||||
145
open_ooc.lua
Normal file
145
open_ooc.lua
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
ext_proc.lua - export and process with an arbitrary binary
|
||||||
|
|
||||||
|
Copyright (C) 2025 Florian Tham <fgtham@gmail.com>.
|
||||||
|
|
||||||
|
Heavily based on gimp.lua and thus is
|
||||||
|
|
||||||
|
Copyright (c) 2016 Bill Ferguson
|
||||||
|
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
open_ooc - open associated out-of-camera jpeg for selected raw files
|
||||||
|
|
||||||
|
This script opens jpeg files for selected raw files. This helps when ignoring
|
||||||
|
jpegs on import, but you want to view the jpeg nontheless.
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* require this script from your main lua file
|
||||||
|
* select an image or images
|
||||||
|
* in the "selected images" section, press "open ooc jpeg"
|
||||||
|
|
||||||
|
BUGS, COMMENTS, SUGGESTIONS
|
||||||
|
* Send to Florian Tham, fgtham@gmail.com
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
local df = require "lib/dtutils.file"
|
||||||
|
local dtsys = require "lib/dtutils.system"
|
||||||
|
local ooc_widget = nil
|
||||||
|
|
||||||
|
local wg = {}
|
||||||
|
|
||||||
|
local MODULE = "open_ooc"
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", MODULE)
|
||||||
|
|
||||||
|
-- from https://github.com/ChristianBirzer/darktable_extra_scripts/blob/main/HeliconFocus.lua
|
||||||
|
-- find locale directory:
|
||||||
|
local os_path_seperator = "/"
|
||||||
|
local scriptfile = debug.getinfo( 1, "S" )
|
||||||
|
local localedir = dt.configuration.config_dir..'/lua/locale/'
|
||||||
|
if scriptfile ~= nil and scriptfile.source ~= nil then
|
||||||
|
local path = scriptfile.source:match( "[^@].*[/\\]" )
|
||||||
|
localedir = path..os_path_seperator..'locale'
|
||||||
|
end
|
||||||
|
dt.print_log( "localedir: "..localedir )
|
||||||
|
|
||||||
|
local gettext = dt.gettext
|
||||||
|
gettext.bindtextdomain(MODULE, localedir)
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- return data structure for script_manager
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
script_data.metadata = {
|
||||||
|
name = _("open ooc jpeg"),
|
||||||
|
purpose = _("open associated ooc jpegs for selected raw files"),
|
||||||
|
author = "Florian Tham <fgtham@gmail.com>",
|
||||||
|
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/open_ooc"
|
||||||
|
}
|
||||||
|
|
||||||
|
script_data.destroy = nil -- function to destory the script
|
||||||
|
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||||
|
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||||
|
script_data.show = nil -- only required for libs since the destroy_method only hides them
|
||||||
|
|
||||||
|
local viewer = {}
|
||||||
|
viewer.executable = "sxiv"
|
||||||
|
viewer.args = ""
|
||||||
|
|
||||||
|
local function open_ooc() --finalize
|
||||||
|
local selected_images = dt.gui.selection()
|
||||||
|
local file_list = ""
|
||||||
|
|
||||||
|
if #selected_images == 0 then
|
||||||
|
dt.print(_("please select an image"))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, image in pairs(selected_images) do
|
||||||
|
if df.get_filetype(image.filename) == "CR3" then
|
||||||
|
current_image = image.path .. os_path_seperator .. image.filename
|
||||||
|
current_image = string.gsub(current_image, ".CR3", ".JPG")
|
||||||
|
if df.check_if_file_exists(current_image) then
|
||||||
|
file_list = file_list .. current_image .. " "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if file_list == "" then
|
||||||
|
dt.print(_("selection empty, or no jpeg available"))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
cmd = viewer.executable .. " " .. viewer.args .. " " .. file_list
|
||||||
|
dt.print_log("open_ooc: " .. cmd)
|
||||||
|
dtsys.external_command(cmd)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
dt.gui.libs.image.destroy_actin(MODULE)
|
||||||
|
dt.destroy_event(MODULE, "shortcut")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register
|
||||||
|
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
MODULE, _("open jpeg"),
|
||||||
|
function() open_ooc() end,
|
||||||
|
_("open associated ooc jpegs for the selected raw files")
|
||||||
|
)
|
||||||
|
|
||||||
|
dt.register_event(
|
||||||
|
MODULE,
|
||||||
|
"shortcut",
|
||||||
|
function(event, shortcut) open_ooc() end,
|
||||||
|
MODULE
|
||||||
|
)
|
||||||
|
|
||||||
|
--
|
||||||
|
script_data.destroy = destroy
|
||||||
|
|
||||||
|
return script_data
|
||||||
Reference in New Issue
Block a user