void CropAndSaveImage() { processImageProgressBar.Visibility = ViewStates.Visible; cancelBtn.Visibility = ViewStates.Gone; doneBtn.Visibility = ViewStates.Gone; rotateCWButton.Visibility = ViewStates.Gone; Task.Run(() => { try { var detector = SDK.ContourDetector(); var documentImage = SDK.ImageProcessor().ProcessBitmap(originalBitmap, new CropOperation(editPolygonImageView.Polygon), false); documentImage = SBSDK.RotateImage(documentImage, -rotationDegrees); var documentImgUri = MainApplication.TempImageStorage.AddImage(documentImage); RunOnUiThread(() => { var extras = new Bundle(); extras.PutString(EXTRAS_ARG_IMAGE_FILE_URI, documentImgUri.ToString()); var intent = new Intent(); intent.PutExtras(extras); SetResult(Result.Ok, intent); Finish(); }); } catch (Exception e) { ErrorLog("Could not apply image changes", e); } }); }