mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 14:56:30 +00:00
fix editing tiled images
This commit is contained in:
@@ -26,4 +26,14 @@ public static class BitmapExtensions
|
||||
|
||||
public static Color CreateTransparent(this Color color, byte transparency) =>
|
||||
Color.FromArgb(transparency, color.R, color.G, color.B);
|
||||
|
||||
public static async Task SaveImage(this BitmapSource bitmap, string path, CancellationToken ct = default)
|
||||
{
|
||||
await using var stream = new FileStream(path, FileMode.Create);
|
||||
var encoder = new JpegBitmapEncoder();
|
||||
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
||||
encoder.Save(stream);
|
||||
await stream.FlushAsync(ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user