Memory consumption was high when we add an image to canvas
Raja VIGNESH B
0
Reputation points
Hi team,
The memory consumption while adding an image to the canvas in Visual studio 2022 was very high. We are adding the image of size 15mb to the canvas. After adding the image to the canvas, the memory consumption was around 800mb. Please find the code snippet that we have used below,
Grid stampGrid = new Grid();
stampGrid.Height = 300;
stampGrid.Width = 400;
BitmapImage bitmapImage = new BitmapImage(new Uri("Path of the image", UriKind.Absolute));
System.Windows.Controls.Image image = new System.Windows.Controls.Image();
image.Source = bitmapImage;
stampGrid.Children.Add(image);
canvas.Children.Add(stampGrid);
Please check on this issue.