private static Bitmap GetPreviewImage(Pixelmap currFrame) { CurrFrame = new AstroImage(currFrame); Bitmap image = currFrame.CreateDisplayBitmapDoNotDispose(); if (OnDrawOverlays != null) { using (Graphics g = Graphics.FromImage(image)) { OnDrawOverlays.Invoke(g); g.Save(); } } return(image); }