i am using the code below to create a live tile, based on an UI element. It renders the uiElement on a WriteableBitmap, saves the bitmap + returns
uiElement
WriteableBitmap
i get same exception when convert uielement to writeablebitmap in taskagent. just tried so many times.i found a soluction get be worked.
wbmp.SaveJpeg(stream, width, heigth, 0, 60);
you can change the quality to 60 when you save uielement to stream. it well reduce memory useage. you can try it.