Xamarin.Forms How can I resize an image

AnonimusCoder 1 Reputation point
2022-11-25T08:25:18.697+00:00

How can I resize an image.The image is getting through an API call and it is larger than the layout so it is not appearing.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 28,876 Reputation points Microsoft Vendor
    2022-11-28T06:12:03.037+00:00

    Hello @AnonimusCoder ,

    You can refer to the official XamFormsImageResize sample. When you get the image, you can get the stream from the image and resize it on each platform.
    The key point is the ImageResizer classs, you can add the source code to your project, then invoke the resize method. The sample shows how to resize the image named "OriginalImage.JPG" in HomePage, you can replace it with your image for testing.

    Best Regards,
    Wenyan Zhang


    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.

    0 comments No comments