I am new on Windows phone development. I am scaling an image, first time it scale image good but when I am choose another picture and implement scale on image so I get a
System.OutOfMemoryException. On this line
ScaleTransform t = new ScaleTransform() { ScaleX = 5, ScaleY = 5 };
My code where I am trying to scale image.
Image uiElement = new Image() { Source = blurImage };
ScaleTransform t = new ScaleTransform() { ScaleX = 5, ScaleY = 5 };
WriteableBitmap writeableBitmap = new WriteableBitmap(uiElement, t);
using (MemoryStream ms = new MemoryStream())
{
writeableBitmap.SaveJpeg(ms, (int)blurImage.PixelWidth, (int)blurImage.PixelHeight, 0, 100);
bmp.SetSource(ms);
imgholder.Source = null;
imgholder.Source = bmp;
ms.Dispose();
}
t = null;
writeableBitmap = null;
uiElement.Source = null;
uiElement = null;
GC.Collect();
How can I solve it?