Skip to content

Commit fe97e29

Browse files
committed
Working? version
1 parent 792e782 commit fe97e29

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

contrib/exportLUT.lua

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ local du = require "lib/dtutils"
3535

3636
du.check_min_api_version("3.0.0", "exportLUT")
3737

38-
-- add a new lib
38+
-- Thanks Kevin Ertel for this trick
39+
local os_path_seperator = '/'
40+
if dt.configuration.running_os == 'windows' then os_path_seperator = '\\' end
3941

4042
local combobox = dt.new_widget("combobox"){label = "on conflict", value = 1, "skip", "overwrite"}
4143

42-
--https://www.darktable.org/lua-api/ar01s02s54.html.php
43-
4444
local file_chooser_button = dt.new_widget("file_chooser_button")
4545
{
4646
title = "Identity_file_chooser", -- The title of the window when choosing a file
@@ -64,24 +64,20 @@ local output_label = dt.new_widget("label"){
6464
}
6565

6666
local separator = dt.new_widget("separator"){
67-
6867
}
6968

70-
local function create_lut(style, haldclut)
71-
haldclut.reset
72-
dt.styles.apply(style, haldclut)
73-
end
74-
75-
local function export_lut(haldclut)
76-
77-
end
78-
7969
local function export_luts()
80-
identity = dt.database.import(file_chooser_button)
70+
identity = dt.database.import(file_chooser_button.value)
8171
for style_num, style in ipairs(dt.styles) do
82-
identity = create_lut(style, identity)
83-
export_lut(identity)
84-
dt.print(style.name)
72+
73+
identity:reset()
74+
dt.styles.apply(style, identity)
75+
76+
io_lut = dt.new_format("png")
77+
dt.print(export_chooser_button.value .. os_path_seperator .. style.name)
78+
io_lut:write_image(identity, export_chooser_button.value .. os_path_seperator .. style.name)
79+
80+
dt.print(export_chooser_button.value .. os_path_seperator .. style.name)
8581
end
8682
end
8783

0 commit comments

Comments
 (0)