mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:26:31 +00:00
0b38d9b24c
add image processing
19 lines
498 B
C#
19 lines
498 B
C#
using System.IO;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace Azaion.Dataset;
|
|
|
|
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;
|
|
}
|
|
} |