lot of small fixes for dataset explorer

This commit is contained in:
Alex Bezdieniezhnykh
2024-09-16 20:12:05 +03:00
parent 42fdee599e
commit 2236eb7fcb
6 changed files with 94 additions and 59 deletions
@@ -0,0 +1,19 @@
using System.IO;
using System.Windows.Media.Imaging;
namespace Azaion.Annotator.Extensions;
public static class BitmapExtensions
{
public static async Task<BitmapImage> OpenImage(this string imagePath)
{
var image = new BitmapImage();
await using var stream = File.OpenRead(imagePath);
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.StreamSource = stream;
image.EndInit();
image.Freeze();
return image;
}
}