RB channel switch while maintaining raw data?

Hi, I am using Adobe LR Mobile on a Huawei P8 Lite 2017 phone. I choose the DNG shooting option in LR. This results in images with the Red and Blue channels switched. Of course, that makes it a bit difficult to do anything with the images unless I convert from Raw, which rather defeats the purpose. So, I’m hoping that there is a way in Raw Therapee to switch the R and B channels without loosing the Raw data. Any ideas? Regards, Colin.

Hi @ColinColin & welcome!

I have a Huawei P Smart and use OpenCamera, set to save in DNG format.
This combination works just fine with Rawtherapee.

More info here: A full Android FOSS raw imageing pipeline (tutorial)

Have fun!
Claes in Lund, Sweden

Hi Claes

the same problem arises with Open Camera, although it seems a fine app. JPG is fine. DNG shows red things blue, blue things red. However, this is on the phone. I wonder whether it might be OK when I get the file off the phone into Raw Therapee on the PC. I’ll let you know.

Thank you for the tutorial.


@ColinColin you’ll increase the chances of finding a solution if you upload a sample raw file.


please see attached. The furniture is in reality bright blue. The fire extinguisher in the background, bright red. Shot with Open Camera app on Huawei P8 Lite 2017. Lighting is mixed daylight and fluorescent tubes. But same RB swap happens in daylight. Eg. London bus bright blue instead of red, blue sky rendered red.

ColinRB inversion.dng (22.5 MB)

To fix the colors by swapping the red-blue channel color designation:

exiftool -IFD0:CFAPattern2='0 1 1 2' 'photo.dng'

1 Like


if that is done without downsampling in any way, it looks to be a perfect solution.

Am I right in thinking that I have to find the Exif Tab and then choose “Add/Edit” Exif metadata to do this?


@ColinColin it doesn’t touch the image data, just the metadata which describes the color order.
Get ExifTool and run the command from a command prompt.
Replace photo.dng with the name of a photo, or *.dng to process all photos in the folder.


exiftool in Windows and dng in Windows and the following result. Anybody know what I’m doing incorrectly?


Try double quotes.


I put the ExifToolGUI.exe, exiftool.exe and the inversion.dng file all in the same folder on the Windows desktop and changed all single quotes to double. I used the command line in the GUI. Not sure if this is the best way but it worked. Many thanks!

I’ll put some play raws up soon, if anyone is interested in seeing what they can do with my experimental extra lo fi phone images.