If I understand your problem, you cannot delete the file from disk without getting an IOException involving shared access. The solution is to set the BitmapImage.CacheOption property to BitmapCacheOption.OnLoad when you load the Bitmap from the file, as I indicated in my sample code. If you do that, you can delete the file at any time. If you don't do that (and your code snippet indicates that you aren't doing it now), then WPF will retain a reference to the file and you will be unable to delete it.
It makes no difference whether the file in question is the original file or a copy you've made of it. The cause of the problem is the same, and the solution to the problem is the same.
-- Tony
It makes no difference whether the file in question is the original file or a copy you've made of it. The cause of the problem is the same, and the solution to the problem is the same.
-- Tony