Hello,
I have been working on a Lua workflow module for my darktable.
My first ever Lua program and I did a lot of copy/paste/modify, but also a lot of trial and error.
I managed to do almost everything I wanted except one thing I can not get to work:
I want to output a jpg image.
I could not find any example, but reading the docs I thought that this is how it should be.
But it does not work.
I do not understand the error message. Where does it expect a dt_imageio_module_format_t ??
I would have thought that imageIOJPG is a subclass of dt_imageio_module_format_t and it does appear
to have a write_image method from the debug output...........
Anybody can tell me what I am doing wrong ??
Thanks,
Jozef Dassen
Code fragment:
-- Get the images in a table
imageTable = dt.gui.selection()
-- walk through the images and write the JPG:
for k, v in pairs(imageTable) do
if type(k) == 'number' then
print("Create Output for ", v, type(v))
local imageIOJPG = dt.new_format("jpeg")
local imageFilename = "/nas01/data/Photo Archives/Darktable Sessions/test02/darktable_exported/test_image.jpg"
print(imageIOJPG, imageFilename)
debug.debug = true
print(debug.type(imageIOJPG), debug.type(v))
print(debug.dump(imageIOJPG))
imageIOJPG.quality = 85
imageIOJPG.max_width = 2500
imageIOJPG.max_height = 2500
imageIOJPG.write_image(v, imageFilename, false)
end
end
Console error:
498.725616 LUA ERROR : /home/dassen/.config/darktable/lua/examples/sessionTool.lua:962: bad argument #-1 to 'write_image' (dt_imageio_module_format_t expected) stack traceback: [C]: in ? [C]: in field 'write_image' /home/dassen/.config/darktable/lua/examples/sessionTool.lua:962: in function </home/dassen/.config/darktable/lua/examples/sessionTool.lua:929> [C]: in ?
Print statements output:Create Output for /nas01/data/Photo Archives/Darktable Sessions/test02/Selects/_D8C6959.NEF userdata dt_imageio_module_format_data_jpeg (0x7f0fe803d338) /nas01/data/Photo Archives/Darktable Sessions/test02/darktable_exported/test_image.jpg dt_imageio_module_format_data_jpeg dt_lua_image_t toplevel (userdata,dt_imageio_module_format_data_jpeg) : dt_imageio_module_format_data_jpeg (0x7f0fe803d338) name (string) : "JPEG (8-bit)" mime (string) : "image/jpeg" write_image (function) extension (string) : "jpg" plugin_name (string) : "jpeg" max_height (number) : 0 max_width (number) : 0 quality (number) : 85 toplevel.metatable : __luaA_TypeName (string) : "dt_imageio_module_format_data_jpeg" __name (string) : "dt_imageio_module_format_data_jpeg" __luaA_Type (number) : 99 __index (function) __associated_object (userdata) : (no metatable) (no uservalue) __next (function) __pairs (function) __luaA_ParentMetatable (table) : __luaA_TypeName (string) : "dt_imageio_module_format_t" __name (string) : "dt_imageio_module_format_t" __luaA_Type (number) : 66 __index (function) __next (function) __pairs (function) __tostring (function) __set (table) : max_width (function) max_height (function) (no metatable) (no uservalue) __newindex (function) __get (table) : extension (function) mime (function) write_image (function) name (function) max_height (function): toplevel.metatable.__luaA_ParentMetatable.__set.max_height max_width (function): toplevel.metatable.__luaA_ParentMetatable.__set.max_width plugin_name (function) (no metatable) (no uservalue) (no metatable) (no uservalue) __tostring (function) __set (table) : max_height (function): toplevel.metatable.__luaA_ParentMetatable.__set.max_height max_width (function): toplevel.metatable.__luaA_ParentMetatable.__set.max_width quality (function) (no metatable) (no uservalue) __newindex (function) __get (table) : name (function): toplevel.metatable.__luaA_ParentMetatable.__get.name mime (function): toplevel.metatable.__luaA_ParentMetatable.__get.mime write_image (function): toplevel.metatable.__luaA_ParentMetatable.__get.write_image extension (function): toplevel.metatable.__luaA_ParentMetatable.__get.extension plugin_name (function): toplevel.metatable.__luaA_ParentMetatable.__get.plugin_name max_height (function): toplevel.metatable.__luaA_ParentMetatable.__set.max_height max_width (function): toplevel.metatable.__luaA_ParentMetatable.__set.max_width quality (function): toplevel.metatable.__set.quality (no metatable) (no uservalue) (no metatable) (no uservalue) toplevel.uservalue : empty
___________________________________________________________________________ darktable developer mailing list to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org