Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up temp file

  • Loading branch information...
commit f8d2f8371f5cbc5968e20eac560f925ffeb6bfea 1 parent dad5a1a
Collins, Sean authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/Enhance/Models/EnhanceImage.cs
View
4 src/Enhance/Models/EnhanceImage.cs
@@ -22,15 +22,17 @@ private BitmapImage ConvertImageToBitmapImage(Image bitmap)
if (bitmap == null) return null;
string fileName = Path.GetTempFileName();
- File.Delete(fileName);
bitmap.Save(fileName, ImageFormat.Bmp);
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
+ bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.StreamSource = new FileStream(fileName, FileMode.Open, FileAccess.Read);
bitmapImage.EndInit();
+ bitmapImage.StreamSource.Close();
+ File.Delete(fileName);
return bitmapImage;
}
Please sign in to comment.
Something went wrong with that request. Please try again.