I want to capture a specific view and convert to an image using RenderTargetBitmap and save the image in local folder. But I am getting 'Insufficient memory to continue the execution of the program' while calling BitmapEncoder.SetPixelData() method. Please find the below code snippet.
BitmapEncoder encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);
encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied,
(uint)imageWidth, (uint)imageHeight, 120, 120, pixelsBytes);
await encoder.FlushAsync();
pixelsBytes.Length is 80621568. (Exception from HRESULT: 0x80030008 (STG_E_INSUFFICIENTMEMORY))' What's wrong with my code.
Regards,
Bharathi.
User contributions licensed under CC BY-SA 3.0