If in doubt, read the documentation:
Image.FromFile Method (System.Drawing) | Microsoft Docs[
^]
Under "Remarks" it is explicitly stated:
MS Documentation:
The file remains locked until the Image is disposed.
WHat that means is that while the Image exists in your application, an exclusive lock is established on the file that you sourced the images data from - and no other application can open it.
To get round this, you need to read the image, copy it, and Dispose the original:
Image youWanted;
using (Image image = Image.FromFile(file))
{
youWanted = new Bitmap(image)
}
The
using
block will Dispose the image for you and release the file lock.