Convert ImageSource to BitmapImage - WPF

后端 未结 2 1340
北海茫月
北海茫月 2021-01-08 00:37

I\'m using a class library that generates a large ImageSource, > 3000x3750 pixels. I would like to convert this ImageSource to BitmapImage so that I can take advantage of De

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-08 01:14

    The BitmapImage type inherits BitmapSource and ultimately ImageSource (both of which are abstract classes). You need to check what the actual type of your object is, i.e. check object.GetType().Name. If you're in luck, it may actually be returning a BitmapSource object and you will simply need to cast it to that type before being able to use it as such.

提交回复
热议问题