As you know, only 11.5 MB of memory can be used for the Windows Phone 8 operating agent. I tried to make a dynamic lock screen image in the background job. When I get an image of 480 * 800, it works fine, but when I change it to 768 * 1280, I throw an exception:
Not enough memory
1 pixel cast 4K
So
(480 * 800 * 4) /1024/1024=1.46M
(768 * 1280 * 4) / 1024/1024 = 3.75M
When I tried to convert byte [] to BitmapImage:
public BitmapImage ConvertDownloadStringToStream(byte[] downloadImageBytes) { if (!(downloadImageBytes.Length > 0)) return null; RationImageInfo currentRationInfor = GetBitmapImageWidthByDeveiceRatio(); BitmapImage convertBitmapImage = new BitmapImage() { DecodePixelWidth =768, DecodePixelHeight = 1280}; using (MemoryStream imageStream = new MemoryStream(downloadImageBytes)) { convertBitmapImage.SetSource(imageStream);
I get a memory exception in the SetSource() method. Anyone have any suggestions on this?
source share