How to crop an image in Xamarin Forms

Vasanthakumar M 251 Reputation points
2021-04-23T06:37:31.553+00:00

Hi Xperts,

How to crop an image as a Circle shape, While uploading the image.

thanks in advance

Developer technologies | .NET | Xamarin
{count} votes

1 answer

Sort by: Most helpful
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,756 Reputation points
    2021-04-28T04:23:16.227+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Take a look at jamesmontemagno/ImageCirclePlugin .

    Check the steps

    • Install in nuget :https://www.nuget.org/packages/Xam.Plugins.Forms.ImageCircle.
    • Initialize in each project Xamarin.Forms.Init(); //platform specific init
      ImageCircleRenderer.Init();
      • Use the control in xaml xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin" <controls:CircleImage Source="{Binding Image}" Aspect="AspectFill">
        <controls:CircleImage.WidthRequest>
        <OnPlatform x:TypeArguments="x:Double">
        <On Platform="Android, iOS">55</On>
        <On Platform="WinPhone">75</On>
        </OnPlatform>
        </controls:CircleImage.WidthRequest>
        <controls:CircleImage.HeightRequest>
        <OnPlatform x:TypeArguments="x:Double">
        <On Platform="Android, iOS">55</On>
        <On Platform="WinPhone">75</On>
        </OnPlatform>
        </controls:CircleImage.HeightRequest>
        </controls:CircleImage>
    • For linking you may need to add: Android : ImageCircle.Forms.Plugin;
      iOS : --linkskip=ImageCircle.Forms.Plugin

    Best Regards,
    Cole Xia


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.


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.