Cr3 Raw wrong Whitebalance


I'm working on a project in whiche I need to load a Cr3 Raw from the Canon EOS 250D, edit further in a c# programm via GDI and save it as Jpg, Tiff or png.
As far I can load the raw file via Libraw and copy the imagebuffer in my c# programm.

After I save the image, the Whitebalance isn't equal to the Cr3 file opened in Photoshop.

How it looks out ouf PS

How it looks out auf Libraw/C#App

Maybe I'm missing something.

My Raw loading code looks like this:

int LoadRaw(char *charBuffer, int size)
  int i, ret, verbose = 0, output_thumbs = 0;
  // Try to use camera WB and RGB colorformat
  libraw_data_t imgD = RawProcessor.imgdata;
  imgD.params.use_camera_wb = 1;
  imgD.params.user_flip = 0;
  imgD.params.output_color = 1;
  pRgbBitmap = RawProcessor.dcraw_make_mem_image(&ret);


It is hard to discuss such

It is hard to discuss such kind of problem without having raw file sample on hands.

-- Alex Tutubalin @LibRaw LLC


in your code sample you make a copy of RawProcessor.imgdata by this line:
libraw_data_t imgD = RawProcessor.imgdata;
Than change your copy, not RawProcessor.imgdata.params

Is this a typo in code sample (you really use reference in your real code)?

-- Alex Tutubalin @LibRaw LLC

almost solved

Haha oh man, thanks for the answer!

I'm stupid, I just wanted it to be done and didn't look right at my garbage.
I fixed the code and the Whitebalance probleme disapeared.

But unfortunaly I ran into another problem.
The red colors seems to be shifted, so brown colors appears bluish.
Also blue seems to become orange.

Here is the correct image as jpg Converted from Photoshop
and the source Raw file:

I tried to play with the settings in Rawprocessor->imgdata.params, but couldn't figure it out.
My code looks now something like this (not production code):

int LoadRaw(char *charBuffer, int size)
	// Result if enabled :
	RawProcessor->imgdata.params.use_camera_wb = 0;
	// Result if enabled:
  	RawProcessor->imgdata.params.use_auto_wb = 1;

Great to hear you've fixed

Great to hear you've fixed the problem w/ white balance.

-- Alex Tutubalin @LibRaw LLC