out of memory Image.FromFile

Viewed 55669

Why is it that I'm getting an out of memory error? Thank you

if (File.Exists(photoURI))
{
    FileStream fs = new FileStream(photoURI, FileMode.Open, FileAccess.Read);
    Image img = Image.FromStream(fs);
    fs.Close();
}
7 Answers

Make sure all the files were closed before you open them again. It could be one of the file still open.

Related