private static void OnThumbnailComplete(IImageProcessor processor, SoftwareBitmap softwareBitmap) { // Note: intentionally not awaited. We just deliver the thumbnail Bitmaps to the UI thread. TaskUtilities.RunOnDispatcherThreadAsync(() => { WriteableBitmap writeableBitmap = new WriteableBitmap(softwareBitmap.PixelWidth, softwareBitmap.PixelHeight); softwareBitmap.CopyToBuffer(writeableBitmap.PixelBuffer); writeableBitmap.Invalidate(); processor.ThumbnailImagSource = writeableBitmap; // The thumbnail image has been copied, so we can destroy the Bitmap. softwareBitmap.Dispose(); }); }