gdi+ - System.Drawing.Image.FromFile does not close the file stream -


If I try to create an image with this method and then delete / modify the image file, Because it still streams using the file.

How do I delete or dispose of this stream so that I can work on file?

Do not use this method instead use the stream and do this:

< Pre> filestream = Using new IO.FileStream ("D: \ Test .JPG", IO.filemoda.updated) Dim X = System. Drawing Image. Finish using frostream ('d: \ test .jpgg'))
(file stream) 'manipulate your image ...' Finish IO File.Delete

Comments