0

I'm using SKIA Sharp to generate some images, however when profiling the encoding part takes in my opinion way too long.

The image has about 10-100 points, 30-140 lines in polygons and 2-20 rectangles (nothing really fancy). The total image generation takes 0.6 seconds - 2 seconds (depending on the number of elements).

The code below takes in about 90-95% of the calculation time. I think this is way too much for a simple png (or am I mistaken?). Is that normal or am I doing something wrong?

    public byte[] GetPNG()
    {
        using SKImage? image = Surface.Snapshot();
        using SKData? data = image.Encode(SKEncodedImageFormat.Png, 50); // <<--- This one
        MemoryStream target = new MemoryStream();
        data.SaveTo(target);
        return target.ToArray();
    }
rst
  • 2,510
  • 4
  • 21
  • 47
  • 1
    Can we have some numbers to work with? "Ages" for an image of unknown size is a bit vague. – Fildor Mar 24 '23 at 22:57
  • If your unhappy with the performance of [SkiaSharp](https://github.com/mono/SkiaSharp) you probably should submit it [here](https://github.com/mono/SkiaSharp/issues). – Tu deschizi eu inchid Mar 25 '23 at 16:18

0 Answers0