blob: 9bed0917cda2261be3c7d67a5226147a2c90282f (
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 Timeline.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();
        }
    }
}
 |