Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic "apply_camera_style.lua" does not process (Pentax) DNG files #18139

Open
thetruemist opened this issue Jan 3, 2025 · 12 comments
Open
Labels
lua scope: camera support adding WB and raw support for new cameras

Comments

@thetruemist
Copy link

Describe the bug

  • I activated the "official/apply_camera_style.lua"
  • it works for e.g. Samsung NX500 *.SRW files
  • it does not process Pentax *.DNG files

Steps to reproduce

  1. Activate "official/apply_camera_style.lua"
  2. Import a Pentax *.DNG file
  3. The existing camera style is not applied

Expected behavior

apply the resp. camera style

Logfile | Screenshot | Screencast

When running with "-d lua", there is no output from "apply_camera_style.lua" when *.DNG is imported, so no log available. A good log output is seen for *.SRW.

Commit

No response

Where did you obtain darktable from?

self compiled

darktable version

5.0.0

What OS are you using?

Linux

What is the version of your OS?

Debian 12

Describe your system?

No response

Are you using OpenCL GPU in darktable?

Yes

If yes, what is the GPU card and driver?

Nvidia

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

The reason for this behavior is the "if image.is_raw then" condition in the "function(event, image)" which is registered as a post-import-image hook. "image.is_raw" seems to be "false" for (Pentax) *.DNG files, but they are raw for sure.

I have commented it out:

dt.register_event(MODULE, "post-import-image",
function(event, image)
-- if image.is_raw then
table.insert(acs.imported_images, image)
-- end
end
)

Now it works for me, but it's a quick-and-dirty fix only.

@jenshannoschwalm
Copy link
Collaborator

Is_raw excludes dosaiced dng . Maybe that's the reason?

@wpferguson
Copy link
Member

The quick and dirty fix will work as long as you only import raws. If you import RAW+JPEG then the JPEG will get the style applied too. This also applies to any other non-raw formats that have EXIF camera info included.

There are keyboard shortcuts that can be assigned to apply the styles to a selection of images or a whole collection.

The script uses darktable's facilities for determining if an image is raw or not. You may want to raise an issue about your DNG file not being detected as a raw.

@wpferguson
Copy link
Member

@jenshannoschwalm if the demosaiced DNG was identified as raw, would darktable then try and demosaic it?

@jenshannoschwalm
Copy link
Collaborator

Well a demosaiced dng would not be identified as is_raw and will not demosaic. That would be an s_raw. If you want both you should use dt_image_is_rawprepare_supported() or dt_image_is_matrix_correction_supported() for raw/s_raw but monochromes excluded.

@wpferguson
Copy link
Member

Lua simply reads the flags set by darktable. I don't know if I want to go down the road of trying to "outsmart" darktable about what a raw is and is not.

@wpferguson
Copy link
Member

wpferguson commented Jan 3, 2025

So, suppose I add an is_s_raw() function to the API. Is there any case where a non-raw gets identified as an s_raw?

I have Canon's and they can shoot sraw. If I shoot sraw with one of my Canon's and import it, is it a raw or an s_raw?

EDIT: @thetruemist can I have a file to test with?

@jenshannoschwalm
Copy link
Collaborator

I know only about converted files .

Would love to get hand on camera provided sraws.

@jenshannoschwalm
Copy link
Collaborator

you could use the functions provided in common/image.c

@thetruemist
Copy link
Author

thetruemist commented Jan 3, 2025

So, suppose I add an is_s_raw() function to the API. Is there any case where a non-raw gets identified as an s_raw?

I have Canon's and they can shoot sraw. If I shoot sraw with one of my Canon's and import it, is it a raw or an s_raw?

EDIT: @thetruemist can I have a file to test with?

Sure. I copied some Pentax DNGs for cameras that I own(ed) to https://drive.google.com/drive/folders/1Ex1_Icuwd0aOhCP1tEpiRIuqKlphuOVN?usp=sharing

The "K3III" is the newest, it's the only one I tested. No idea if it's already demosaiced. Did not try the others with the apply_camera_style yet.

@wpferguson
Copy link
Member

you could use the functions provided in common/image.c

Looked and is_raw() calls dt_image_is_raw(). I can do the is_s_raw() and call dt_image_is_rawprepare_supported()

Would love to get hand on camera provided sraws.

I'll shoot some and put them somewhere for you.

@ralfbrown ralfbrown added scope: camera support adding WB and raw support for new cameras lua labels Jan 3, 2025
@wpferguson
Copy link
Member

wpferguson commented Jan 3, 2025

should use dt_image_is_rawprepare_supported() or dt_image_is_matrix_correction_supported()

Both return false. But if I open one of the images in darkroom, rawprepare gets applied.

EDIT: Both check the DT_IMAGE_S_RAW flag, but it's not set so they return false.

EDIT 2: If I import the files and look at the flags the only flag set is 1 for 1 star. When I open them in darkroom, the raw flag and a couple of others get set. So, it looks like there is no current way to detect a DNG raw on import.

@thetruemist
Copy link
Author

EDIT 2: If I import the files and look at the flags the only flag set is 1 for 1 star. When I open them in darkroom, the raw flag and a couple of others get set. So, it looks like there is no current way to detect a DNG raw on import.

Hmm, ok. Would it be possible to match the file name on *.DNG and additionally check maker=="Pentax"? Sure, a workaround, and if someone really creates a non-raw DNG from a Pentax image, and imports, then the style would get applied although it should probably not, but I think that's a pretty unlikely scenario (compared to ooc Pentax DNGs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lua scope: camera support adding WB and raw support for new cameras
Projects
None yet
Development

No branches or pull requests

4 participants