darktable icon indicating copy to clipboard operation
darktable copied to clipboard

scale pixels corrupts images exported from CR3

Open fuzzah opened this issue 1 month ago • 2 comments

Is there an existing issue for this?

  • [x] I checked and did not find my issue in the already reported ones

Describe the bug

Hello.

After applying scale pixels to a Canon's CR3 RAW file, the export module saves partially corrupted images.

Sometimes, the lighttable module shows similar behavior as well, by cutting off parts of the images when zooming in.

Steps to reproduce

  1. Open a CR3 file in the darkroom mode.
  2. Apply scale pixels with a value far from 1.0, such as 0.5, 1.25, or 2. Values like 1.1 don't seem to cause the issue (or it happens relatively rare compared to other values).
  3. Export the file using any size, quality, and either set or unset options "allow upscaling" and "high quality resampling". In my examples, I have used 20% JPEG quality and size limits of 800x800.
  4. The exported file is now most likely corrupted. In my case, it's ~90% chance of corruption.

I had to upload sample files to google drive due to github's file size restrictions.

Expected behavior

No response

Logfile | Screenshot | Screencast

How it looks in a file manager: Image

Commit

No response

Where did you obtain darktable from?

distro packaging

darktable version

5.2.1

What OS are you using?

Linux

What is the version of your OS?

Arch Rolling fully updated as of 2025-11-29

Describe your system

RAM: 64 GB, GPU: RX 6700 XT.

Are you using OpenCL GPU in darktable?

I dont know

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

JPG and other RAW formats don't seem to be affected. Tested: JPG, CR2, ORF. May be related to the size of my CR3? It's from Canon EOS R5 so it's 45MP.

fuzzah avatar Nov 28 '25 23:11 fuzzah

Okay, so, to check if the issue actually stems from the file size, rather than from CR3 specifically, I used the "IBIS high resolution shot" feature on my R5 to get a 400MP JPEG file. Usually such pictures can be exported, and this unedited image was indeed exported without problems, but when I applied scale pixels at x1.25 and tried exporting again, darktable consumed like 32.5 gigs of RAM, froze for about 2 minutes and then crashed. So to me it looked like some memory allocation issue.

Here was the workaround:

sudo pacman -S gperftools
LD_PRELOAD=/usr/lib/libtcmalloc.so.4.6.3 darktable

And then the desqueezed file of 400MP in size was exported just fine.

Turned out, CR3 files could now be exported as well.

So my guess is: the "scale pixels" feature uses way too much RAM, as I refuse to believe 64 gigs is not enough :)

fuzzah avatar Nov 29 '25 00:11 fuzzah

Just mentioning - also fully described in the manual - if you are processing a 400-mega-pixel image that requires a lot of ram.

If you want us to investigate we need a log `-d pipe -d opencl' using the raw file will be good.

jenshannoschwalm avatar Nov 29 '25 07:11 jenshannoschwalm