Hi, I use darktable to develop raw files from my Sony a7c camera (uncompressed 14-bit ARW files). In darktable, these images are 6048 x 4024 px and so are the darktable-exported JPGs.
However, the JPGs from the camera itself are 6000 x 4000 px. I think, the camera JPGs are slightly cropped because the pixels in the border regions of the sensor sometimes don’t have reliable signal.
In the exif data of the ARW files there are the tags named ‘DefaultCropSize’ and ‘SonyCropSize’, both having the value ‘6000 4000’. My question is if there is a way to get darktable to automatically crop the images to the value of one of these tags when exporting to JPG.
You could also define a preset for the crop module (possibly auto-applied for that camera body: crop module does not retain a final size and position, but cut-offs from the edges).
Specifying that size of 6000×4000 on export might not do what you expect, afaik the export module scales the image, it doesn’t crop it. In addition, it does all it can to keep the aspect ratio. (and 6048:4024 \neq 6000:4000)
Thanks for the hint, I’ve changed the corresponding line to <Crop x="24" y="12" width="-24" height="-12"/>
and this seems to do the trick.
To be honest, I haven’t experienced problems with the full size images (6048 x 4024 px) so far. My original motivation was to reproduce the camera JPGs with darktable (there may be a good reason for the crop to 6000 x 4000 px inside the camera that I’m not aware of).
But I’m unsure now if the crop is a good idea. In the cameras.xml I saw that for some other cameras there are only the pixels on the right side removed, e.g. <Crop x="0" y="0" width="-32" height="0"/>
for the Sony ILCE-7CR.
Is there a good reason to do the crop or should I stick to the full size images as long as there are no obvious artifacts? If there is a resason for the crop, should it be done only on one side of the image or symetrically? Is there some kind of best practice and how do others handle this?
Thanks for the tip. However, in the crop module, the crop can only be specified relatively (precentage) and not in absolute pixel values. That’s the reason I prefer to edit the cameras.xml file, as described above
Thanks, I won’t use to the export module to specify the output size in this case.
One can also enable control of the crop in the raw black/white point module, and then create a preset. To do that, edit the allow_edit_crop line in your darktablerc file.
I’ve downloaded a sample raw file from the ILCE-7CR and inspected it, as you said. In the following, the bottom right region of the sample image (passthrough enabled):
The ILCE-7CR file has black borders on the bottom and the right side, so obviously no signal there.
The right columns of the signal-containing region clearly show artificial artifacts.
The raw black/white point module in darktable correctly crops off the black borders and also the region with the artifacts.
I’ve tried different values for the crop for this camera in the cameras.xml file - however, with no effect. It seems that the raw black/white point module determines the crop for this camera using another source than the cameras.xml file (maybe the tags in the file?).
For my ILCE-7C camera, there are no black borders or obvious artifacts when enabling passthrough. So I’ve decided to stick to the darktable default behavior (no cropping) until I may observe any problems.
I’ve edited the corresponding line to plugins/darkroom/rawprepare/allow_editing_crop=true
However, I couldn’t find additional controls in the module to edit the crop. Maybe I’m missing something obvious.
Offtopic question: Is there a way in darktable to determine the position (row/column) and numeric raw value for a single pixel?
In the past, I’d added an option to rawspeed’s XMLs to enable automatic crop based on raw file metadata. Originally, all crops had to be added manually after visual inspection of raw files, which is bonkers, and it still is the case, unfortunately. I’ll go check if it’s still there.
EDIT: Here it is: Crop Panasonic G9 images using vendor metadata · jsmucr/rawspeed@302a284 · GitHub It makes rawspeed use vendor-provided crop information by just removing the Crop element. The thing is I had the same issue with my G9 where the extended crop was fine with some images and unusable with others. That’s why I think the vendor crop should be the default one to use.
Changing darktablerc while darktable is running probably won’t work: darktable may overwrite that file on closing, throwing away your changes (as dt never saw them!).
That’s a general point to keep in mind with any program. Configuration files can maintain state on closing, thus are overwritten on closing the program, destroying any changes you made “by hand” while the program was running. Most programs only read their config files on start-up. If a program behaves different, there’s usually a good reason for that, and it’s mentioned in the manual for that software (e.g.: a long-running server can have a list of blocked IP addresses as a configuration file, re-reading that list every so often allows the admin to add addresses to that list).
I’ve tried editing the file while darktable was closed and even after rebooting, I assured myself that the line was still plugins/darkroom/rawprepare/allow_editing_crop=true
before starting darktable.
Any other hints? Do you have a screenshot of how these crop controls should look like? I really think I’m missing something obvious…
Thanks! I also think that vendor-provided crop information should be used in the first place. The code in your commit seems to handle only Panasonic-specific tags and this only when the Crop element is missing.
So it think this isn’t an explanation for darktable seemingly ignoring the crop entry in the cameras.xml file for the Sony ILCE-7CR.
Thanks for the screenshot. I definitely don’t have these crop controls.
Darktable 4.6.1 win64 on Windows 10 here, editing the file C:\Program Files\darktable\share\darktable\darktablerc
Any other hints what I could try to get these controls appearing?