Resizing Image distorts its pixels around corners

May 19, 2013 at 7:00 PM
Edited May 19, 2013 at 7:04 PM

I needed to resize an image so I used following code:
WriteableBitmap img2 = new WriteableBitmap((int)width, (int)height);
img2 = img.Resize((int)width, (int)height, WriteableBitmapExtensions.Interpolation.Bilinear);
destination.Blit(new Rect(coords.X, coords.Y, img2.PixelWidth, img2.PixelHeight), img2, new Rect(0,0, img2.PixelWidth, img2.PixelHeight));
return destination;
But when i save this destination image it becomes distorted around the edges and gives me this image:

Any ideas for what can be wrong here?