darktable-org / darktable-org/darktable
In "Rotate and Perspective", add "original size" as an option for automatic cropping
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.1k
- Forks
- 1.4k
- Avg merge
- 22h 14m
- Merged PRs (30d)
- 198
Description
Is your feature request related to a problem? Please describe.
I scan my film negatives for Darktable's Negadoctor module, using a Minolta DiMAGE Scan Elite 5400 scanner. Since this scanner uses an elongated "free-hanging" film holder that tends to be tilted downward around the first and last image within the holder, each imported .dng image requires a specific rotate value between zero and around 0,5° in the "Rotate and Perspective" module.
Later down the pipeline, in the Crop module, the "actual" image must be separated from the included film holder frame. Because the Crop module (including its presets) works with percentage values, it requires the same input dimensions to reach a consistent cropping result. None of the given options (in Rotate and Perspective), however, allow for this.
The problem is that currently, each setting for automatic cropping (within "Rotate and Perspective") changes the passed-on image size:
- "None" enlarges the image dimensions via the outer corners delimiting the new rectangle's sides.
- "Largest area" and "original format" both shrink the image with different shape factors via the original sides delimiting the new rectangle's outer corners.
Describe the solution you'd like
What is needed for a consistent cropping result in the Crop module is an "original size" automatic cropping option in "Rotate and Perspective." This would leave the passed-on image dimensions untouched, using the existing dimensions as a stencil that cuts into the rotated original, while the empty areas could be filled with white, as the "None" option already does.
Alternatives
- The current requirement is to individually reverse the changes in image dimensions within the Crop module, adjusting the crop window (with the "shift" button pressed to retain the image ratio) while constantly checking the resulting pixel dimensions in the info box in the middle. This is tedious and appears unnecessary.
- Another option could be to alternative add a functionality in the Crop module, allowing users to save presets not via relative percentage values but by absolute pixel dimensions.
Additional context
I use Darktable 5.7.0+34~g8e304c92e0 on Win11.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the automatic cropping options in the Rotate and Perspective module and review how they interact with the Crop module's percentage-based presets. Add an "original size" option that preserves the existing image dimensions while filling the rotated image's empty areas as described, then verify that downstream Crop presets receive consistent dimensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100