darktable-org / darktable-org/lua-scripts

Allow programatically reading / setting output color profile of an image to be exported

未关闭
#522 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

API change req'd enhancement
主要语言
Lua
星标
219
派生
142
PR 合并指标
30 天内没有已合并 PR

描述

Forked from pixls.us thread:

In a script, I'm using the following code to export an image to JPG:

local exporter = dt.new_format("jpeg")
exporter.quality = 95
exporter:write_image(src, dest)

That code is dependent on the export module's output color profile currently selected in the UI. I would like to either force a specific profile (let's say Display P3 RGB), or detect when an invalid profile (for my purpose) is used, to be able to warn the user. My options with the current API are:

  1. dt.gui.action("lib/export/profile", 0, "selection", "first", 0.0) + dt.gui.action("lib/export/profile", 0, "selection", "next", 10.0) as Display P3 RGB is currently the 11th one displayed; that's hardcoded in colorspaces.c.

    Pro: Unobtrusive.
    Con: Depends on DT internals without their proper representation through the API. If DT profile order ever changes, the script forcefully selects a different profile.

  2. dt.gui.action("lib/export/profile", 0, "selection", "popup", 0.0)

    Pro: Doesn't depend on DT internals, user could select their own ICC profiles too.
    Con: Obtrusive; user is prompted to the action even if the current settings are correct, they are also asked to select the only correct option.

  3. Export, then check the resulting file metadata, and error out post factum.
    Pro: Unobtrusive.
    Con: Suboptimal UX, as I cannot prevent the error from happening, or implement input data validation before triggering the action. Possibly the metadata won't be there if export doesn't have the EXIF.

  4. Export outside of DT
    Pro: Total control over the output.
    Con: Needs an intermediary export in DT to a format that isn't sensitive to color profile (does it even exist?) to retain changes done to the RAW in DT, like cropping etc.

All of the workarounds above would not be needed if the Lua API allowed for:

  • Setting output color profile in dt_imageio_module_format_t.write_image, or
  • Reading/setting output color profile of dt_lua_image_t (this might be through #414). I could then use image settings profile in export, which is the first option in the combobox, or
  • Reading/setting the combobox options by their name in export's profile combobox (the item: prefix doesn't seem to work there)

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Lua API 入口 dt.new_format("jpeg") 和 dt_imageio_module_format_t.write_image 开始,然后检查所引用的 colorspaces.c 中的 profile 排序以及 issue #414。比较所请求的读取或设置 export profile 的方式,并将完成定义为:脚本能够选择或检查 output profile,而不依赖 UI 排序。

由索引模型根据 Issue 内容生成。

评估

技术栈
lua
领域
api
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。