Convert processed raw to bitmap does not work well
Hi!
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):
1. libraw_init
2. libraw_open_file - opening a Canon CR2 file
3. libraw_unpack
4. libraw_dcraw_process
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.
7. libraw_dcraw_clear_mem
8. libraw_close
Everything works without any error, but the result picture after opening is somehow wrong.
Orignal picture from CR2 file:
https://imgur.com/a/bM8bhCE
Converted and saved bitmap:
https://imgur.com/4s6hPmt
As you can see, the bitmap is B/W and somehow distorted.
Any idea?
BR,
Ladislav
Recent comments