The following code illustrates the problem I am faced with. If I load a CR2 file with
var format = FREE_IMAGE_FORMAT.FIF_RAW;
retVal = FreeImage.LoadBitmap("AJ2A1447.cr2", ref format);
then I successfully load the RAW file. If I use something like
using (Stream stream = new FileStream("AJ2A1447.cr2", FileMode.Open, FileAccess.Read))
{
var format = FREE_IMAGE_FORMAT.FIF_RAW;
freeImageHandle = FreeImage.LoadFromStream(stream, ref format);
if (freeImageHandle.IsNull)
{
throw new Exception("Unable to load image from stream");
}
retVal = FreeImage.GetBitmap(freeImageHandle);
}
then I am unsuccessful as freeImageHandle is null. I use FileStream for a test, the real code will use a MemoryStream.
Any clue to why LoadFromStream fails?