For many (but not all) RAW formats, you can use this trick:
1) Call LibRaw::open_file()
2) Position to libraw_internal_data.unpacker_data.data_offset
3) Read libraw_internal_data.unpacker_data.data_size bytes
This method will work with Canon CR2, Nikon NEFs and many others.
This method will not work for tiled DNGs
For many (but not all) RAW formats, you can use this trick:
1) Call LibRaw::open_file()
2) Position to libraw_internal_data.unpacker_data.data_offset
3) Read libraw_internal_data.unpacker_data.data_size bytes
This method will work with Canon CR2, Nikon NEFs and many others.
This method will not work for tiled DNGs