darktable-org / darktable-org/darktable

Moiree When Using "Rotate and Perspective" Module on Grainy Image

Open
#18,167 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

no-issue-activity
Dominant language
C
Stars
13.1k
Forks
1.4k
Avg merge
22h 14m
Merged PRs (30d)
198

Description

Describe the bug

When rotating certain particularly grainy images (in this case a JPEG scan of Ilford Delta 3200), a moiree pattern emerges which is especially noticeable in areas with little to no detail, such as skies and walls. Note that this effect is not noticeable in the original image, nor is it visible in darktable so long as the Rotate and Perspective module is disabled (or set to 0°). These examples are screenshots from within darktable, but the same effect is visible in the exported images unless downscaled.

The only workaround I've found is to export images at a smaller resolution, which I suppose causes some resampling to occur, fixing the issue. Needless to say, this is an unsatisfactory workaround as it prevents me from exporting images at higher resolutions.

Example A:
No rotation:
Screenshot 2025-01-06 at 2 32 20 PM
With rotation:
Screenshot 2025-01-06 at 2 32 26 PM

Example B:
No rotation:
Screenshot 2025-01-06 at 2 34 14 PM
With rotation (much smaller pattern size in this one, seemingly due to the greater rotation angle):
Screenshot 2025-01-06 at 2 34 21 PM

Example C:
No rotation:
Screenshot 2025-01-06 at 2 34 36 PM
With rotation:
Screenshot 2025-01-06 at 2 34 41 PM

Steps to reproduce
  1. Import a grainy jpeg image (might occur with other image formats too, though I assume the compression plays a role here) which contains uniformly coloured, textureless areas, such as plain walls, skies, etc. and switch to darkroom. I'm attaching a portion of an image where this is most noticeable.
    sampleimage2

  2. Enable the Rotate and Perspective module

  3. Change the rotation factor to any value other than 0°. The farther the value is from 0°, the smaller the moiree pattern will appear. I find the effect is most noticeable at around ±1°, though this varies depending on the image resolution.

  4. The image will now have a moiree effect, most noticeable around areas with little to no detail/texture/etc. Depending on the resolution of the image and amount of rotation applied, it might not be very noticeable without zooming in/out.

Expected behavior

Darktable should rotate the image without producing any odd artifacts

Logfile | Screenshot | Screencast

No response

Commit

No response

Where did you obtain darktable from?

downloaded from www.darktable.org

darktable version

5.0.0

What OS are you using?

Windows

What is the version of your OS?

Windows 10 Pro. Also occurs on darktable running on MacOS Sonoma 14.6.1

Describe your system?

Windows 10 system has a Ryzen 1700, 32gb of ram and a 1080Ti with 11gb of vram. MacOS Sonoma system is a 16-inch 2019 MacBook Pro and has a 2.6Ghz 6 core i7, 16gb or ram and a Radeon Pro 5300M with 4gb of vram. Darktable was installed via the .exe downloaded from the website on the Windows 10 system, and via homebrew on the MacOS Sonoma system.

Are you using OpenCL GPU in darktable?

Yes

If yes, what is the GPU card and driver?

Nvidia 1080Ti 11GB

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

I haven't tested other versions. This occurs with JPEG files, I don't have RAW files to test this with. The above steps are reproducible with a fresh edit. The issue appears in the output image, but is first apparent within darktable itself. Nevertheless, I have attached the corresponding .xmp file (which has had .txt appended to the filename so Github will accept the file). The issue is present with a new config (I installed darktable on another system while troubleshooting to confirm that it wasn't an issue with my machine). I don't use lua scripts.

400533955-b9709f33-015d-4170-9b69-3b4c3f3efb1d.jpg.xmp.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rotate and Perspective module entry point and reproduce the artifact using the attached grainy JPEG or XMP file, varying the rotation around ±1°. Compare the darkroom view and exported output with the module disabled and enabled; done means rotation no longer introduces the moiré pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.