ImageFromFile Method |
Namespace: Accord.Imaging
The method is provided as an alternative of FromFile(String) method to solve the issues of locked file. The standard .NET's method locks the source file until image's object is disposed, so the file can not be deleted or overwritten. This method workarounds the issue and does not lock the source file.
string filename = Path.Combine(basePath, "lena.pgm"); // One way to decode the image explicitly is to use Bitmap image1 = ImageDecoder.DecodeFromFile(filename); // However, you could also obtain the same effect using Bitmap image2 = Accord.Imaging.Image.FromFile(filename);