Skip to content

Conversation

@AyedaOk
Copy link

@AyedaOk AyedaOk commented Jan 17, 2026

  • Added support for PNG raster masks (8/16-bit)
  • Added image folder chooser override for raster masks (can be set in the preferences).
  • Added relative path when using the image folder override.

The png support fixes issue #19667 and part of issue #19829.

The image folder possibly fix #19689

The relative path fixes issue #20088

@jenshannoschwalm
Copy link
Collaborator

jenshannoschwalm commented Jan 17, 2026

Aah :-) Had a quick first look right now with nothing appearing bad to me now. will review and check the next days.

Also, welcome to the party!

@jenshannoschwalm jenshannoschwalm added feature: enhancement current features to improve feature: new new features to add scope: image processing correcting pixels scope: DAM managing files, collections, archiving, metadata, etc. labels Jan 17, 2026
@TurboGit TurboGit added this to the 5.6 milestone Jan 20, 2026
Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested yet. Two points:

See 66d9708 for the updated _check_extension().

Also be prepared for conflicts when #20198 is merged.

Do we really want the extra complexity for enforcing the mask directory. Current behavior which is remembering the last used directory seems just fine to me.

All in all I think you should separate the work in two PR. One for supporting PNG and one for the root directory to be discussed.

TIA.


char *extension = g_strrstr(filename, ".");
char *ext_lower = extension ? g_ascii_strdown(extension, -1) : NULL;
const gboolean is_png = ext_lower && !g_strcmp0(ext_lower, ".png");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify with : g_ascii_strcasecmp()

@AyedaOk
Copy link
Author

AyedaOk commented Jan 26, 2026

I looked at https://github.com/darktable-org/darktable/pull/20198 and found that it makes my pull request irrelevant. PNG files were needed to avoid keeping large pfm files on our drives. With vectorisation, we no longer need to keep the mask files, so the relative path is also irrelevant.

  1. In my humble opinion, this would be the place for a “present image to an outside algorithm, get the result file from there and convert it with the new algorithm” workflow (without using the rastermask folder).

If this is implemented (or Lua like you suggested), the image folder will also no longer be needed.

In my opinion, this PR can be rejected now. What do you guys think?

@jenshannoschwalm
Copy link
Collaborator

  1. Supporting pngs would be good in any case
  2. Supporting locations other than the given path would likely be required in a way. Not sure how exactly

So maybe a PR just for png now?

@TurboGit
Copy link
Member

Agreed, PNG support for now would be good.

@AyedaOk
Copy link
Author

AyedaOk commented Jan 27, 2026

Good. I'm on it!

@AyedaOk
Copy link
Author

AyedaOk commented Jan 29, 2026

I've updated the PR to png support only. I'm not sure what the right procedure is, but I think when #20198 is merged, I will rebase, check for conflict and push again. Let me know if this is fine.

@wpferguson
Copy link
Member

Is there a function that I can call with a filename to load the mask file? I'm thinking of Lua integration being able to load a mask from a script.

@AyedaOk
Copy link
Author

AyedaOk commented Jan 30, 2026

Right now there isn’t a function to load the mask file from Lua, but that would be nice. I tried looking at how this could be done, but I don’t understand the code enough yet to pull it out.

@wpferguson
Copy link
Member

I just need the name of a function in your module that I can call with a filename. I can handle interfacing it to Lua.

Let's say int your module there is a function called dt_load_external_mask(const char *fname) that would load the mask file and make it available to the pipeline.

I would then add a function to the Lua API to load a mask that would basically take a filename and then call dt_load_external_mask or whatever it's called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: enhancement current features to improve feature: new new features to add scope: DAM managing files, collections, archiving, metadata, etc. scope: image processing correcting pixels

Projects

None yet

4 participants