Force Daylight WB?

Is there a way to force raw processing to use daylight WB? I would like to ignore WB as set in the camera and process all images using daylight WB. With no WB selected, the images I have tested seem to come out with a yellow cast. While this can be corrected using an ICC profile afterwards, it would be nice to use a starting point closer to an accurate target rendition.


draw_emu w/o switches (-w -a)

draw_emu w/o switches (-w -a) and/or Libraw API w/o use_camera_wb/use_auto_wb processes images with daylight WB

-- Alex Tutubalin @LibRaw LLC

Force Daylight WB?

When I set use_camera_wb and use_auto_wb both to zero, I get a yellow cast on the image. When I set use_camera_wb to 1 and take the same photo with camera WB set to daylight it there is no yellow cast. (Camera is Sony A7R4, but I get similar results from Olympus Pen-F). I can email you sample images if you don't believe me.

Is anything else that could affect WB?

Here is the code I am using to read and process the image:

// create an image processor

LibRaw iProcessor;

// open the file and read the metadata

err = iProcessor.open_file(pathname);
if(err != 0)

// set to 16-bit output

iProcessor.imgdata.params.output_bps = 16;
iProcessor.imgdata.params.no_auto_bright = 1;
iProcessor.imgdata.params.use_camera_wb = 0;
iProcessor.imgdata.params.use_auto_wb = 0;

// metadata is accessible through data fields of the class

nx = iProcessor.imgdata.sizes.width;
ny = iProcessor.imgdata.sizes.height;

// unpack the image

err = iProcessor.unpack();
if(err != 0)
goto error;

// process the image

err = iProcessor.dcraw_process();
if(err != 0)
goto error;

Force Daylight WB?

A further note, probably irrelevant -- if I set no_auto_bright to zero, the white balance looks better - but some of the channels are clipped.

When yo set use_camera_wb,

When yo set use_camera_wb, LibRaw uses camera reported WB coefficients.
If not, 'daylight WB' coeffs are calculated from built-in color profile, this coeff may differ.

To avoid (most of) clipping due to auto bright, one may set auto_bright_thr to very low value (e.g. 0.0)

-- Alex Tutubalin @LibRaw LLC

Alternatively, one may use

Alternatively, one may use camera preset from imgdata.color.WB_Coeffs/WBCT_Coeffs if present for specific camera(raw file)

-- Alex Tutubalin @LibRaw LLC