Add new comment

Requesting to submit a patch for direct raw access?

Hello! For starters, thank you for putting together a wonderful toolkit!

I'm working on a C# project that currently uses FreeImage for raw image processing, and converting it over to libraw so it can support newer raw image formats.

The application already has its own interpolation/debayering and other postprocessing code -- what I need back from libraw's C API is a straight shot at the unpacked raw image data. Unfortunately, all the code pathways through the C API only allow for access once the image has gone through dcraw_process(), and that isn't what I need back. I could write the raw image, call unprocessed_raw on the file, and then read the resulting TIFF file, but I'd rather not go out to the disk if I can avoid it -- its a lot of unnecessary overhead.

Would you be willing to extend the API with 10 lines of code ? This gives the C API a means to get directly at the raw data, and does everything a lot cleaner from C#.

ushort* libraw_get_raw_data(libraw_data_t* lr)
if (!lr)
return NULL;

if (!&(lr->rawdata))
return NULL;

return (lr->rawdata.raw_image);

Please advise, and thanks!