-
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
public static byte[] ToArray(Image image)
{
if (image?.Source is not StreamImageSource streamImageSource)
return [];
using MemoryStream memory = new();
Stream? streamFromImageSource = streamImageSource.Stream(CancellationToken.None).GetAwaiter().GetResult();
if (streamFromImageSource is null)
return [];
streamFromImageSource.CopyTo(memory);
return memory.ToArray();
}Reactions are currently unavailable