简体   繁体   中英

How to get size of resized image?

In UWP I have this Image

<Image Source="{Binding Bitmap}" Stretch="Uniform"/>

I want to get size of the resized Bitmap inside Image element in code behind, so I have this

Image img = ...;

var width = img.Width; // this gives size of Image element not the bitmap resized
                       // inside the Image.

So the original Bitmap could have size of 1920x1080 but Image element size is 300x200, so the bitmap inside it would have size of 300x112.5 given Stretch=Uniform . I want to get 300x112.5

使用ActualWidth / ActualHeight属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM