Return clone to avoid problems with disposing original memorystream

This commit is contained in:
Malte Rosenbjerg 2020-12-06 01:15:16 +01:00
parent 01b1dd228e
commit 25c650f7fc

View file

@ -69,7 +69,8 @@ public static Bitmap Snapshot(IMediaAnalysis source, Size? size = null, TimeSpan
.ProcessSynchronously();
ms.Position = 0;
return new Bitmap(ms);
using var bitmap = new Bitmap(ms);
return bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), bitmap.PixelFormat);
}
/// <summary>
/// Saves a 'png' thumbnail to an in-memory bitmap