Unable to get cropped image size

I am trying to get the cropped image size before saving to determine if I should rotate the image or not. With the attached code I am getting that the height is greater than the width, even though the width is actually greater. 

I am using the ActualImageRenderedBounds, which is probably the incorrect property. 


 editor.Crop();


            IsCropEnabled = false;

            Crop.IsVisible = Cancel.IsVisible = false;


            if (VM.SelectedCardImageEnumInt == (int)CardImageEnum.Logo)

            {

                if (VM.InitialRotation != 0)

                {

                    editor.Rotate();

                }

            }

            else

            {

                var shouldRotate = editor.ActualImageRenderedBounds.Width > editor.ActualImageRenderedBounds.Height;


                if (VM.InitialRotation == 0)

                {

                    if(shouldRotate)

                    {

                        editor.Rotate();

                    }

                }

                else

                {

                    editor.Rotate();


                    if (shouldRotate)

                    {

                        editor.Rotate();

                    }

                }


Attachment: ImageProcess.cs_1a6bf14e.zip

1 Reply

ET Eswaran Thirugnanasambandam Syncfusion Team December 13, 2021 12:08 PM UTC

Hi Seth,

Greetings from Syncfusion.

We have created a sample using the provided snippet and checked the reported issue. We can determine the actual picture size after cropping using the ActualImageRendereredBounds property, and based on the cropping size, we can meet your requirements. Please get the sample from the below link.

https://www.syncfusion.com/downloads/support/directtrac/general/ze/XamarinImageEditor1089455557  

Please check the sample. If you still face any problem, can you revert by modifying the sample based on your scenario or can you please explain your scenario in detail, this will help us to provide you with a better solution at the earliest.

Regards,
Eswaran.


Loader.
Up arrow icon