No idea about the algorithm, but the way to resize an image is fairly easy:
public static Bitmap ResizeImage(Image image, Int32 width, Int32 height)
{
Bitmap destImage = new Bitmap(width, height);
using (Graphics graphics = Graphics.FromImage(destImage))
graphics.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
return destImage;
}
With this, you can load the original image, resize it, and save the resized image to disk:
public void ResizeImageFromPath(String imagePath, Int32 width, Int32 height, String savePath)
{
if (savePath == null)
savePath = imagePath;
Byte[] bytes = File.ReadAllBytes(imagePath);
using (MemoryStream stream = new MemoryStream(bytes))
using (Bitmap image = new Bitmap(stream))
using (Bitmap resized = ResizeImage(image, newwidth, newheight))
resized.Save(savePath, ImageFormat.Png);
}