darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.88k stars 1.15k forks source link

Fuji GFX50R raf images have bad rawprepare cropping data #17861

Open selmanbey opened 1 week ago

selmanbey commented 1 week ago

Describe the bug

My raw Fuji GFX50R images (RAF) gets cropped when I open them in darkroom. In lighttable, when they are not edited, you see the full image. But once you open them in darkroom, the images get cropped in a rather aggressive way. They seem to get cut mostly (or entirely) from the right side, causing a frame ratio change as well. And this edit is not to be found in any of the modules / history and I cannot restore the cropped image to its original size / ratio. Only if I reset all the history and then go back to lighttable, I can see the full image again. When I'm in darkroom, it's always cropped.

P.S. JPEGs seem to work just fine. The issue only happens with RAW file.

Steps to reproduce

  1. Here's an example RAW image to use for debugging purposes (can provide more if required) https://drive.google.com/file/d/1ugsHU6_3FlRjqoCYjx4xgw8BPrSBp2_t/view?usp=drive_link

  2. Open the image in lighttable (or in a different software, like Capture One) and see the original

  3. Open it in darkroom and compare with the original. You'll notice that it's cut / cropped by default from the right side (and there does not seem to be any way to reverse that crop)

Expected behavior

darkroom should not crop images by default

Logfile | Screenshot | Screencast

lighttable / original:

Screenshot 2024-11-19 at 22 39 45

darkroom / cropped:

Screenshot 2024-11-19 at 22 39 56

Commit

No response

Where did you obtain darktable from?

downloaded from www.darktable.org

darktable version

4.8.1

What OS are you using?

Mac

What is the version of your OS?

Sonoma 14.6

Describe your system?

Macbook Air, M2, 2022

Are you using OpenCL GPU in darktable?

No

If yes, what is the GPU card and driver?

No response

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

Can you reproduce with another darktable version(s)? I haven't tried with other versions Can you reproduce with a RAW or Jpeg or both? Jpeg's seem to work just fine, it's RAW files only Are the steps above reproducible with a fresh edit (i.e. after discarding history)? Yes If the issue is with the output image, attach an XMP file It happens on every edit, including with very fresh ones Is the issue still present using an empty/new config-dir (e.g. start darktable with --configdir "/tmp")? I don't really know as I only use the standard GUI variant Do you use lua scripts? Not to the best of my knowledge, no

jenshannoschwalm commented 1 week ago

@selmanbey you might want to change the cropping in "raw/black-white point" - see the manual how to do that. There is a hidden option.

@kmilos one for you maybe?

selmanbey commented 1 week ago

@selmanbey you might want to change the cropping in "raw/black-white point" - see the manual how to do that. There is a hidden option.

Thank you! Looking into the manual, I see that there is an extra setting, "flat field correction", under "raw black/white point" module, which I don't get in my Darktable version (which is the latest release, 4.8.1). Not sure if that's because the manual is outdated there.

I get the "black level 1/2/3/4" and "white point" settings, neither of which are particularly helpful regarding the crop. What helps, however, is the built-in preset "passthrough" on the module. When I apply it, it reverses the image back to its original size. That messes up all the colours and exposure though.

So what I ended up doing was to create a preset with the default black level & white point settings (which seems to be pretty much the same for all the images i've tried so far) on top of the passthrough preset, so that I can apply it to the images instead and create styles with it.

Screenshot 2024-11-20 at 18 24 30

Hacky, but works, and that's already a big win. So, thanks a million.

kmilos commented 1 week ago

What Hanno was referring to was the allow_editing_crop setting in your darktablerc file that will expose crop controls in the raw black/white levels module.

I'll take a look at the sample as soon as I get a chance...

selmanbey commented 1 week ago

ah okay, thanks. I set it to TRUE and yes, i can see the automatically applied crops now. plenty on the right and a little bit on the bottom:

Screenshot 2024-11-20 at 19 07 37
kmilos commented 2 days ago

Something is a bit confusing w/ the metadata in the linked file:

[RAF]           RawImageFullSize                : 6912x4530
[RAF]           RawImageCropTopLeft             : 8 12
[RAF]           RawImageCroppedSize             : 6768x4512
[RAF]           RawImageWidth                   : 8280
[RAF]           RawImageHeight                  : 6208

Is this some special mode of the camera? Shouldn't the image be ~50MPix, not ~30MPix?

Edit: RawSpeed indeed defines this crop:

<Crop x="0" y="0" width="-938" height="-4"/>

But I reckon it is for the "regular" 50MPix which was the only one available at RPU and tested... Maybe other crop modes were added in later firmware versions for this camera?

selmanbey commented 2 days ago

@kmilos Yes, it's more than likely that this picture is shot with "35mm format mode" on.

https://fujifilm-dsc.com/en/manual/gfx50r/menu_shooting/shooting_setting/index.html#35mm_format_mode

I use that setting with most of my adopted lenses to prevent heavy vignetting. But the default crop darktable applies is still not correct, because it is a second crop on top of the in-camera, 35mm mode crop.

kmilos commented 2 days ago

But the default crop darktable applies is still not correct

The crop is correct for the full 50MPix mode, as I already mentioned.

Now that we know there is new mode, support for it will have to be added separately (or handled differently). You'll just have to use this manual workaround in the meantime I'm afraid.

RPU explicitly instructs users to upload raw files for all crop modes/bit depths/compressions; unfortunately AFAIK for all GFX cameras users uploaded only the full one, this is the first time we hear there is a different mode... Do all GFX cameras have this 35mm format mode?

selmanbey commented 2 days ago

Now that we know there is new mode, support for it will have to be added separately (or handled differently). You'll just have to use this manual workaround in the meantime I'm afraid.

No problem. Thanks for looking into it!

Do all GFX cameras have this 35mm format mode?

I only have 50R myself, but checked out a few other GFX manuals online now and seems like, yes, they all have this mode.

kmilos commented 2 days ago

@selmanbey Please feel free to test the linked PR. After closing dt and making the changes, you might want to a) try the reset button of the raw b/w point module, or b) remove the previously imported images from the database, and their sidecars from disk and import them again. Note that this will also slightly change the crop of the "full" medium format sensor mode for future imports as well.

P.S. We ended up doing the same for the sports crop of X cameras.