Changing raw crop does not work

Hi,
I tried to change the Raw crop for my Sony a7IV files as the rightmost 10 pixels contain garbage, but the settings in Camconst.json are ignored.
I added the line
“raw_crop”: [ -20, -20, -20, -20 ]
or, to match Adobe DNG converter:
“raw_crop”: [ 24, 8, 7008, 4672 ]
to the entry for the a7IV to test, but it does nothing (yes, I restarted RT :slightly_smiling_face:).

The Raw files I’m using are from the Adobe DNG converter. I shoot uncompressed Raw in camera and then convert it with Adobe DNG converter (with lossless compression) to get smaller files (The lossless compressed in-camera Raw are not recognized by RawTherapee, a known issue).
The Adobe DNG files contain a 7008x4672 preview jpg, but RT opens the files with 7032x4680 resolution.
No matter what I do, RT keeps opening the files at 7032x4680. I tried changing the raw crop value in the camconst file in the installation directory as well as next to the options file in the user app data directory, same result :slightly_frowning_face:.
Any idea what I can do to change the raw crop to get rid of the 10 pixels on the right?
A sample can be found here: File-Upload.net - P2022.12.11-114154.DNG
Thanks!

Edit: I just tested with original out-of camera uncompressed Raw files, this shows the same problem, so it does not seem related to something caused by Adobe DNG converter.

I’ve noticed these garbage edges in other Sony camera’s recently. See e.g. Border interpolation artifacts with APS-C crop (Sony ILCE-7S) · Issue #6654 · Beep6581/RawTherapee · GitHub and related How do we handle cropped raw images? · Issue #3960 · Beep6581/RawTherapee · GitHub

As for the raw_crop, you’re not following the correct syntax. First coordinate is number of pixels to crop from the left, second coordinate is number of pixels to crop from the top, third number is the desired resulting image width, fourth number is the desired resulting image height.
Putting negative numbers in the first two coordinates does not make sense. Putting negative numbers in the last two should work because that effectively indicates you want to crop pixels from the right and bottom, respectively.

For example

"raw_crop": [ 0, 0, -36, 0 ],

Gets rid of the garbage for me.

Your second option does not work, because you’re not actually removing pixels from the right side of the image. (24 + 7008 = 7032, which is the full width of the image).

Thanks for the info. However, even if I add the line exactly as you suggested, it is still completely ignored by RT. I tried with plain RT 5.9 and also 5.9-7-g1cc3b0eb6.
Here’s the complete entry for the camera:

{ // Quality C
    "make_model": "Sony ILCE-7M4",
    "dcraw_matrix": [ 7460, -2365, -588, -5687, 13442, 2474, -624, 1156, 6584 ] // ColorMatrix2 using illuminant D65 from Adobe DNG Converter 14.2
	"raw_crop": [ 0, 0, -36, 0 ]
},

I also tried with the comma after the raw crop line:

{ // Quality C
    "make_model": "Sony ILCE-7M4",
    "dcraw_matrix": [ 7460, -2365, -588, -5687, 13442, 2474, -624, 1156, 6584 ] // ColorMatrix2 using illuminant D65 from Adobe DNG Converter 14.2
	"raw_crop": [ 0, 0, -36, 0 ],
},

What am I doing wrong?

You’re missing a comma at the end of the “dcraw_matrix” line, before the comment starts. This is invalid JSON.

Thanks, that helped to finally solve it :smiley: