Convert processed raw to bitmap does not work well
According to documentation which for dcraw_make_mem_image says:
This function allocates memory buffer and stores unpacked-preprocessed image into this buffer. Function returns allocated structure libraw_processed_image_t with filled fields. Always returns data as RGB bitmap
I am trying to save the image from buffer as a bitmap image.
Here are the exact steps I am doing (using the Libraw C wrapper):
2. libraw_open_file - opening a Canon CR2 file
5. libraw_dcraw_make_mem_image - returns the structure libraw_processed_image_t
6. using the data, data_size fields from libraw_processed_image_t structure I am creating a 24BitsPerPixel bitmap having dimensions defined by width/height from the structure and saving it.
Everything works without any error, but the result picture after opening is somehow wrong.
Orignal picture from CR2 file:
Converted and saved bitmap:
As you can see, the bitmap is B/W and somehow distorted.