Cr3 Raw wrong Whitebalance

Hello,

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
http://neuland.wtf/img/ps.jpg

How it looks out auf Libraw/C#App
http://neuland.wtf/img/libraw.jpeg

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;
  RawProcessor.open_file(charBuffer);
 
  // 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;
  RawProcessor.unpack();
  RawProcessor.get_decoder_info(&decInfo);
  RawProcessor.dcraw_process();
  pRgbBitmap = RawProcessor.dcraw_make_mem_image(&ret);
}

Forums: 

It is hard to discuss such

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

-- Alex Tutubalin

Followup:

Followup:
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

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
http://neuland.wtf/img/correct.jpg
and the source Raw file:
http://neuland.wtf/img/srcraw.CR3

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)
{
	RawProcessor->open_file(charBuffer);
 
	// Result if enabled : http://neuland.wtf/img/camera_wb.jpeg
	RawProcessor->imgdata.params.use_camera_wb = 0;
 
	// Result if enabled: http://neuland.wtf/img/auto_wb.jpeg
  	RawProcessor->imgdata.params.use_auto_wb = 1;
 
  	RawProcessor->unpack();
  	RawProcessor->dcraw_process();
}