There are problems with Images which aren't immediately obvious: for example, when you load an image from a file using the
Image.FromFile Method (System.Drawing) | Microsoft Docs[
^] it creates a Stream object to read the file, and creates the bitmap from that - and if you use a stream, it must remain in existence for the lifetime of the image, which means that the original file is locked and cannot be opened again, either by your app or any other until the Image and it's underlying Stream has been Disposed.
This is generally a bad idea, and often leads to your app crashing because the file is in use (by your app) when the user tries to use it again ...
The solution is to create a copy of the file based image and use that:
Image result;
using (Image image = Image.FromFile(pathToImage))
{
result = new Bitmap(image);
}
Don't forget to Dispose of the result Image when your app is finished with it! They use significant amounts of memory ...