This doesn't really make any sense, but a big problem is that you're using
Image.FromFile
. This will keep the file locked for the lifetime of the
Image
object and prevent you from writing new file content to it. In order to get around this, you have to create a FileStream object and pass that to
Image.FromStream
. Then you can close the FileStream and then write to the file any way you want.
Examples...[
^]