.Net MAUI

Image Scaling in .NET MAUI

When use an Image Control… 🧐 Have you ever been confused between the different values ​​of the Aspect property? You are in the right place😎 , in this article you will learn the difference of each one!


Let’s start!

Exploring the Aspect Property

The Image control has an Aspect property  which allow us to indicate how an image will fit into the display area (scaling). This property offers different values ​​which allows us to play with the visualization.

Let’s look at each one of them:

➖ AspectFit: Allow the entire image to fit in the display area (If necessary letterboxes the image), it takes care of adding spaces at the top and bottom or on the sides (depending on the dimensions of the image). 

➖ AspectFill: Clips the image to fill the display area without altering the aspect ratio.

➖ Fill: It’s responsible for stretching the image to completely fill the display area.
⚠ This stretching can distort the image.

➖ Center: It’s responsible for centralizing the image in the display area without altering the aspect ratio.

 


And done!! ? From now on, you are ready to play with the Image Aspect property in .NET MAUI I hope you like it! 💚💕

<Label Text=”Thanks for ready! 👋 ” />
 
 
 
Tagged ,

6 thoughts on “Image Scaling in .NET MAUI

Leave a Reply

Your email address will not be published. Required fields are marked *