static public Bitmap CloneToGdiBitmap(this IBitmap iBitmap) { if (iBitmap?.EngineElement is Bitmap) { var gdiBitmap = (Bitmap)iBitmap.EngineElement; return(gdiBitmap.Clone(new Rectangle(0, 0, iBitmap.Width, iBitmap.Height), gdiBitmap.PixelFormat)); } return(iBitmap.ToGdiBitmap()); }