Return clone to avoid problems with disposing original memorystream

Former-commit-id: 25c650f7fc
This commit is contained in:
Malte Rosenbjerg 2020-12-06 01:15:16 +01:00
parent 4d6db5a9b5
commit 02946e16d1

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