I can't seem to get the libraw_data_t->params.use_camera_wb flag to work. I suspect I'm doing something wrong.

I have a Sony .ARW file which unpacks with the wrong colors if use_camera_wb isn't set to 1. It unpacks correctly under dcraw with use_camera_wb set to 1.

Setting this item to 1 in libraw causes it to unpack with the wrong colors.

Here's a simplified version of what I'm doing - I'm using the libraw C interface.

libraw_data_t *lrd=libraw_init(0);





libraw_processed_image_t *lpi=libraw_dcraw_make_mem_image(lrd,&err);

//and then we read the pixels out of lpi->data and put them in a Windows device-independent bitmap

Any suggestions what's wrong? Most raw files unpack correctly.

Thanks, and thanks for an excellent library.



use_camera_wb=1 will force to

use_camera_wb=1 will force to use RAW-embedded color profile for Sony cameras (because use_camera_matrix is set to 1 by default, that means use it with camera-provided WB, but do not use if other WB is set). This may be problem cause if, for example, RAW-embedded profile is bad or damaged.

Could you please provide this specific raw sample for analysis? You may E-mail it to (our mail server accepts up to 70Mb attachments, so most sony files, except 14-bit uncompressed 40Mpix will pass). Or upload it somewhere (Dropbox, google, WeTransfer) and send link to mail address mentioned above

-- Alex Tutubalin

It's all my fault.

Thanks - this turned out to be a problem of my own making. I'll pass it along in case anyone runs into the same issue.

I'm developing under Windows.

I built the libraw.dll library using the VC++ project included with the distribution.

The software that calls libraw.dll is developed using a different compiler. There appear to be some object size and alignment differences between them. As such, things in libraw_data_t weren't where the calling program expected them to be. Setting use_camera_wb from the calling program actually wrote the int to the wrong place.

I worked around this by writing some additional get and set functions so the data in a libraw_data_t need never be accessed directly by the calling program.

Thanks again for your help, and for a great library.


Yes, it is better to use same

Yes, it is better to use same compiler flags for both app and library :)

Also, your C-API getter/setter patches are welcome

-- Alex Tutubalin