We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Image dimensions are adjusted and reducing the image byte[] size

Hey!


I have an app where I can take a picture, crop and rotate it and then send it to a server (without saving it on the phone). My question consists of two parts.


1) Image dimensions are adjusted

The picture that I take is of a certain size, but when this is transfered to SfImageEditor the dimensions change in such a way that the sides of the taken picture are removed. This is of course not very good, so I need to have one of the following solutions:

- Adjusting the size of the camera page where the picture is taken. For that I need to know which size the image is set to in SfImageEditor and I have no idea how to figure that out.

- Making sure that the image dimensions remain the same in the SfImageEditor, thus not cutting of the edges.


2) Reducing the image byte[] size

When the image is adjusted, it is set as Stream and then set as Byte[] so that it can be transferred to the server. The size however is too large (must be below 2 MB). How can I reduce its size to under 2 MB in a cross-platform manner?


Best,


8 Replies

ET Eswaran Thirugnanasambandam Syncfusion Team February 6, 2023 06:34 PM UTC

Hi Ganesh Gebhard,


Query 1: Image dimensions are adjusted

We checked the reported problem, and the SfImageEditor control will not change the dimensions of the taken picture. Please get the tested sample and video from the below attachment.


Query 2: Reducing the image byte[] size

We checked the reported problem, but we are unable to replicate the problem from our side. Please get the tested sample and video from the below attachment.


Please check the sample. If you still face the similar problem, can you revert us by modifying the sample based on your scenario along with issue reproducing video and testing device details, this will help us to provide you with a better solution at the earliest.


Regards,

Eswaran


Attachment: CameraGallery_c41e6f26.zip


GG Ganesh Gebhard February 6, 2023 11:02 PM UTC

Hi Eswaran,


I made demo which shows my issue. Is this a version issue maybe? Please take a look.

(input a valid license in App.xaml.cs)


Concerning the reduction of the image size: this is not a problem you replicate on your side. It is quite simple: there is an image in a stream and its size needs to be reduced without saving the image on the 


Best,


Attachment: ImageEditorDemo_25d7fc9a.zip


ET Eswaran Thirugnanasambandam Syncfusion Team February 7, 2023 01:02 PM UTC

Currently, our development team is validating the reported problem, and provide further details in two business days. We appreciate your patience until then.



ET Eswaran Thirugnanasambandam Syncfusion Team February 9, 2023 01:57 PM UTC

Our development team needs some more time to validate the reported problems, and we will update further details by tomorrow (Feb 10, 2023).



ET Eswaran Thirugnanasambandam Syncfusion Team February 10, 2023 01:56 PM UTC

Our development team need some more time to validate the reported problem and we will update further details on or before two business days.



ET Eswaran Thirugnanasambandam Syncfusion Team February 13, 2023 01:34 PM UTC

Query: Image dimensions are adjusted

We have checked the reported problem, and the issue is not caused by the SfImageEditor control. The actual problem occurs with the CameraView toolkit control. The SfImageEditor control only displays the provided image source. A framework issue has already been reported with the CameraView control regarding image dimension adjustment and the issue link is provided below: https://github.com/xamarin/XamarinCommunityToolkit/issues/1695


We will provide further details once we get solution from the posted query.


Query: Reducing the image byte[] size.

The size of the processed image stream is determined by the size of the input image that is loaded into the SfImageEditor control. Also, SfImageEditor do not support image compression. So, if you load an image that is less than 2 MB into the SfImageEditor, The output stream byte size will also be less than 2 MB.



GG Ganesh Gebhard February 14, 2023 04:03 PM UTC

Query: Image dimensions are adjusted

Thank you for the link.


Query: Reducing the image byte[] size.

It seems that the camera view causes the image to be too large as well, so I have to wait for an update for that package (or find something new).



PR Preethi Rajakandham Syncfusion Team February 15, 2023 07:26 AM UTC

Hi Ganesh,

Thank you for the update. We are pleased to hear that our response has been helpful to you.  Please let us know if you have any further queries on this. We are happy to help.

Regards,

Preethi R



Loader.
Live Chat Icon For mobile
Up arrow icon