diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt index b5617392..43eac568 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt @@ -18,6 +18,7 @@ import android.os.Parcelable import android.provider.MediaStore import android.util.AttributeSet import android.util.Pair +import android.util.Size import android.view.LayoutInflater import android.widget.FrameLayout import android.widget.ImageView @@ -501,6 +502,17 @@ class CropImageView @JvmOverloads constructor( mCropOverlayView!!.initialCropWindowRect = rect } + /** This returns the expected image size, if cropping the image right now. */ + fun expectedImageSize(): Size? { + val rect = cropRect ?: return null + + return if (rotatedDegrees == 0 || rotatedDegrees == 180) { + Size(rect.width(), rect.height()) + } else { + Size(rect.height(), rect.width()) + } + } + /** * Gets the crop window's position relative to the parent's view at screen. *