darktable-org / darktable-org/lua-scripts

get introspection in lua

Open
#195 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
219
Forks
142
PR merge metrics
No merged PRs in 30d

Description

hello,

I was willing to write a lua script that changes some values (like exposure) in a bunch of pictures, I didn't found any.

I thougth to start writing a "tool" to do this, it is far from ready but i think it is a good starting point if someone would like to collaborate

I never used lua before so you may find some weird syntax, you can find the code here
https://repl.it/@VincenzoG/Darktable-xmp

example code:

require "tools/xmp_utility"

input = "0000000010c7babce0ce773e00004842000080c0"

exposure_params = {mode = 1, black = 2, exposure = 3, deflicker_percentile = 4, deflicker_target_level = 5}
exposure_table = dt_xmp_decode(input)

print(table.concat(exposure_table, " "))
print("Mode:", exposure_table[exposure_params.mode])
print("black:", exposure_table[exposure_params.black])
print("exposure:", exposure_table[exposure_params.exposure])
print("deflicker_percentile:", exposure_table[exposure_params.deflicker_percentile])
print("deflicker_target_level:", exposure_table[exposure_params.deflicker_target_level])

print(dt_xmp_encode(exposure_table))

exposure_table[exposure_params.exposure] = exposure_table[exposure_params.exposure] - 0.02
print("new exposure:", exposure_table[exposure_params.exposure])
print(dt_xmp_encode(exposure_table))

and it's output:

0 -0.022799998521805 0.24200010299683 50 -4
Mode:   0
black:  -0.022799998521805
exposure:   0.24200010299683
deflicker_percentile:   50
deflicker_target_level: -4
0000000010c7babce0ce773e00004842000080c0
new exposure:   0.22200010299683
0000000010c7babcfe53633e00004842000080c0

todo list:

  • use compressed values: i found on google some part of code but i didn't integrated them, yet, you could find them in the base64.lua file
  • automatically read/write the params: this can be done knowing the file path and using one of the already existing xml library for lua

If someone would like to collaborate tell me!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked Darktable-xmp script and the base64.lua file mentioned in the TODO list. Clarify the intended introspection interface and how existing Lua XML libraries should read and write params. Done would require an agreed scope plus working compressed-value handling and automatic parameter read/write.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.