Home / Lua API Manual / darktable / darktable.register_storage
< darktable.register_lib
darktable.styles >

# darktable.register_storage

    function(
      plugin_name : string,
      name : string,
      [store : function],
      [finalize : function],
      [supported : function],
      [initialize : function],
      [widget : types.lua_widget]
    )

This function will add a new storage implemented in Lua. A storage is a module that is responsible for handling images once they have been generated during export. Examples of core storages include filesystem, e-mail, pwigo…

- plugin_name - string - A unique name for the plugin.
- name - string - A human readable name for the plugin.
- [store] - function - This function is called once for each exported image.
- [finalize] - function - This function is called once all images are processed and all store calls are finished.
- [supported] - function - A function called to check if a given image format is supported by the Lua storage.
- [initialize] - function - A function called before storage happens.
- widget - types.lua_widget - A widget to display in the export section of darktable’s UI.

# 🔗[store]

    function(
      storage : types.dt_imageio_module_storage_t,
      image : types.dt_lua_image_t,
      format : types.dt_imageio_module_format_t,
      filename : string,
      number : integer,
      total : integer,
      high_quality : boolean,
      extra_data : table
    )

This function is called once for each exported image. Images can be exported in parallel but the calls to this function will be serialized.

- storage - types.dt_imageio_module_storage_t - The storage object used for the export.
- image - types.dt_lua_image_t - The exported image object.
- format - types.dt_imageio_module_format_t - The format object used for the export.
- filename - string - The name of a temporary file where the processed image is stored.
- number - integer - The number of the image out of the export series.
- total - integer - The total number of images in the export series.
- high_quality - boolean - True if the export is high quality.
- extra_data - table- An empty Lua table to take extra data. This table is common to the initialize, store and finalize calls in an export series.

# 🔗[finalize]

    function(
      storage : types.dt_imageio_module_storage_t,
      image_table : table,
      extra_data : table
    )

This function is called once all images are processed and all store calls are finished.

- storage - types.dt_imageio_module_storage_t - The storage object used for the export.
- image_table - table - A table keyed by the exported image objects and valued with the corresponding temporary export filename.
- extra_data - table - An empty Lua table to store extra data. This table is common to all calls to store and the call to finalize in a given export series.

# 🔗[supported]

    function(
      storage : types.dt_imageio_module_storage_t,
      format : types.dt_imageio_module_format_t
    ) : boolean

A function called to check if a given image format is supported by the Lua storage; this is used to build the dropdown format list for the GUI.

Note that the parameters in the format are the ones currently set in the GUI; the user might change them before export.

- storage - types.dt_imageio_module_storage_t - The storage object tested.
- format - types.dt_imageio_module_format_t - The format object to report about.
- return - boolean - True if the corresponding format is supported.

# 🔗[initialize]

    function(
      storage : types.dt_imageio_module_storage_t,
      format : types.dt_imageio_module_format_t,
      images : table of types.dt_lua_image_t,
      high_quality : boolean,
      extra_data : table
    ) : table or nil

A function called before storage happens This function can change the list of exported functions

- storage - types.dt_imageio_module_storage_t - The storage object tested.
- format - types.dt_imageio_module_format_t - The format object to report about.
- images - table of types.dt_lua_image_t - A table containing images to be exported.
- high_quality - boolean - True if the export is high quality.
- extra_data - table - An empty Lua table to take extra data. This table is common to the initialize, store and finalize calls in an export series.
- return - table or nil - The modified table of images to export or nil If nil (or nothing) is returned, the original list of images will be exported If a table of images is returned, that table will be used instead. The table can be empty. The images parameter can be modified and returned

< darktable.register_lib
darktable.styles >