blob: ffbb38ae5694f32d5c14bf297fe84febbc67c1d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.PixelFormats;
using System.IO;
namespace TimelineApp.Tests.Helpers
{
public static class ImageHelper
{
public static byte[] CreatePngWithSize(int width, int height)
{
using var image = new Image<Rgba32>(width, height);
using var stream = new MemoryStream();
image.SaveAsPng(stream);
return stream.ToArray();
}
public static byte[] CreateImageWithSize(int width, int height, IImageFormat format)
{
using var image = new Image<Rgba32>(width, height);
using var stream = new MemoryStream();
image.Save(stream, format);
return stream.ToArray();
}
}
}
|