31 lines
761 B
C#
31 lines
761 B
C#
|
using SixLabors.ImageSharp;
|
||
|
using SixLabors.ImageSharp.PixelFormats;
|
||
|
|
||
|
namespace TimelapseApi.ClassExtensions;
|
||
|
|
||
|
public static class Extensions
|
||
|
{
|
||
|
public static async Task AddAsync(this VideoFileCreator video, Image<Rgb24> img)
|
||
|
{
|
||
|
using(var ms = new MemoryStream())
|
||
|
{
|
||
|
img.SaveAsPng(ms);
|
||
|
byte[] data =ms.ToArray();
|
||
|
await video.AddAsync(data);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
public static void Add(this VideoFileCreator video,Image<Rgb24> img)
|
||
|
{
|
||
|
|
||
|
using(var ms = new MemoryStream())
|
||
|
{
|
||
|
img.SaveAsPng(ms);
|
||
|
byte[] data =ms.ToArray();
|
||
|
video.Add(data);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|