Skip to content

Commit 60ec9b5

Browse files
committed
Use OnLoaded to ensure the wallpaper file is not locked
1 parent 83f02f5 commit 60ec9b5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Flow.Launcher/Helper/WallpaperPathRetrieval.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public static Brush GetWallpaperBrush()
7575
// Set DecodePixelWidth and DecodePixelHeight to resize the image while preserving aspect ratio
7676
var bitmap = new BitmapImage();
7777
bitmap.BeginInit();
78+
bitmap.CacheOption = BitmapCacheOption.OnLoad; // Use OnLoaded to ensure the wallpaper file is not locked
7879
bitmap.UriSource = new Uri(wallpaperPath);
80+
bitmap.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
7981
bitmap.DecodePixelWidth = decodedPixelWidth;
8082
bitmap.DecodePixelHeight = decodedPixelHeight;
8183
bitmap.EndInit();

0 commit comments

Comments
 (0)