I'm building a Xamarin app, using ImageSharp for image manipulation.
I've noticed that the ImageSharp operations are very slow in the emulator and ridiculously slow when deployed to a physical device (Galaxy Note 8).
Things that are way slow:
// Load image (very slow)
var image = SixLabors.ImageSharp.Image.Load(stream);
// Manipulate image (equally slow)
image.Mutate(i => i.Resize(new ResizeOptions
{
Mode = ResizeMode.Pad,
Position = AnchorPositionMode.Top,
Size = new SixLabors.Primitives.Size(600,400))
}));
Note that the image loads fine (albeit slowly) and the resizing works, but it's very slow (30-60 seconds).
Executing the same code from a .NET Core console program reduces the load and manipulation times to about 1-2 seconds.
With the debugger attached, I see a flood of these when ImageSharp operations are running:
GC_MINOR: (Nursery full)
I'm not really sure how to troubleshoot this, is my only option to clone the ImageSharp repo and debug using a custom build?
Edit: Not sure if this may be related to this issue?
Edit #2: I gave up on ImageSharp and also tested OpenCV to no particular avail and then settled on SkiaSharp which works great right out of the box.