I want to capture RAW images from a Canon Camera (EOS 550D and EOS 1300D) and convert them to RGB without saving them on disk. I was assuming that this should be possible, given the fact that EdsCreateImageRef accepts a StreamRef, which can be either a FileStream or a MemoryStream. However, whenever I use a MemoryStream instead of a FileStream, EdsGetImageRef will return EDS_ERR_FILE_FORMAT_UNRECOGNIZED. I tried several variants:
- downloading into a MemoryStream and calling EdsGetImageRef directly on this
- same as above with a seek to the begin of the stream in between
- downloading into a MemoryStream, extracting data into my own databuffer and filling a new MemoryStream with this data
- Loading data from disk (from a known-valid CR2 file) manually and filling a MemoryStream with it
The only thing that works is to dump the data to disk, then open this file with EdsCreateFileStream and passing this to EdsGetImageRef. Has anyone ever been able to create a ImageRef for a MemoryStream and if so, can you give pointers as to what needs to be done for this to succeed?