简体   繁体   中英

WP8 App crashes while trying to create instance of Writablebitmap in c# -Insufficient memory

I would like to do a Image conversion in image to byte array and byte to image in windows phone app. now,i tried to covert image to byte conversion,for that

first i create an instance of writablebitmap class with argument as uielement (ie)

WriteableBitmap btmMap = new WriteableBitmap(Imagecontrol,null); 

in this line app getting crashes because of

Insufficient memory to continue the execution of the program

how can i solve this issue in wp8 ?

You don't need to use the WriteableBitmap constructor that takes an UIElement parameter, because you already have the WriteableBitmap within the Image control.

Just cast the Source property of the Image control as WriteableBitmap:

WriteableBitmap wb = Imagecontrol.Source as WriteableBitmap;

Maybe that will avoid the Out of memory Exception.

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