'Insufficient memory to continue the execution of the program' while calling BitmapEncoder.SetPixelData

0

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.

c#
.net
uwp
uwp-xaml
xamarin.uwp
asked on Stack Overflow Oct 10, 2019 by Bharathi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0