开发者

Changing a System.Windows.Media.Imaging.ImageSource Image size/resolution?

I have an image source of type System.Windows.Media.Imaging.ImageSource and I was wondering how I could get its resolution/size as well as modify the actual source data to change the file si开发者_Python百科ze and image dimensions.


You can cast it to BitmapSource and then access those properties.

if (theImage.ImageSource is BitmapSource)
{
    BitmapSource bitmap = (BitmapSource)theImage.ImageSource;
    int width = bitmap.Width;
}

Here is more info on the BitmapSource class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜