RawTherapee
RawTherapee copied to clipboard
Can't open .DNG files smaller than 225 by 225
Short description
rawtherapee-cli
can't open certain .dng files if its dimensions are smaller than 225 by 225 photosites.
Steps to reproduce
rawtherapee-cli -c small.dng
using the small.dng
from dngs.zip.
The command yield the following output:
RawTherapee, version 5.10-64-g6dd99ca3d, command line.
Output is 8-bit integer.
Processing: small.dng
Error loading file: small.dng
Expected behavior RawTherapee should produce a JPEG image of the input .dng, instead of rejecting the file.
Additional information
The behavior is present in RawTherapee-cli version 5.9 and a fresh debug build version 5.10-64-g6dd99ca3d
.
Normally the program exits normally when rejecting the .dng file, introducing breakpoints into the source, and recompiling, reveals that the is_raw
check rawimage.cc:474
fails.
My next guess would be that dcraw can't parse the file, however dcraw small.dng
works.
About the build:
Version: 5.10-64-g6dd99ca3d
Branch: dev
Commit: 6dd99ca3d
Commit date: 2024-02-18
Compiler: cc 13.2.1
Processor: x86_64
System: Linux
Bit depth: 64 bits
Gtkmm: V3.24.8
Lensfun: V0.3.4.0
Build type: debug
Build flags: -std=c++11 -ffp-contract=off -march=native -Werror=unused-label -Werror=delete-incomplete -fno-math-errno -Wno-attributes -Wall -Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result -Wunused-macros -fopenmp -Werror=unknown-pragmas -g -ftree-vectorize
Link flags: -march=native
OpenMP support: ON
MMAP support: ON
Build OS: Linux 6.1.71-1-MANJARO x86_64
Build date: Tue, 27 Feb 2024 06:59:08 +0000 UTC
Build epoch: 1709017148
Build UUID: 51a73295-d3bd-4abb-8d86-48fad46346bd
This is the reason: https://github.com/Beep6581/RawTherapee/blob/c3402b18d55871e5787b30d5cc651ef29c5254a6/rtengine/dcraw.cc#L9612-L9615
Files smaller than 100,000 bytes will be ignored. The code is very old and precedes the git history, so I can't see the reason why the size limit is there. If the limit is removed, the small dng (8540 bytes) loads fine.
Ah, I was guessing https://github.com/Beep6581/RawTherapee/pull/6576 and not that, but that's a good find!
DNGs such as @GustavMH 's are extremely rare but obviously valid (such as possibly from one of those ultra-high-speed cameras), so I'm guessing this was a bad assumption from the times when any camera that shot raw was a few megapixels.