Crop image in .Net maui

Mielesplayz 291 Reputation points
2022-12-23T10:23:32.753+00:00

Is it possible to allow users to crop the image they picked from the FilePicker?
I have done some research, but I couldn't find any useful information.
If it's possible, is it also possible to force users to use the 1:1 crop setting?

Thanks

Developer technologies .NET .NET MAUI
{count} votes

2 answers

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2022-12-26T01:52:46.45+00:00

    Hello,

    You could use Clip property to crop image on MAUI.

    For instance, you could use the following code to crop the image:

       var clip1 = new RectangleGeometry(new Rect(100, 100, 100, 100));  
       image.Clip = clip1;  
    

    Please refer to Clip with a Geometry to get more details.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. MR.KITTY 0 Reputation points
    2023-04-16T16:08:55.9966667+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.