Today, my friend asked me to recommend a free resize photo tool, and he got lots of photos. I really don’t know. Normally I use MS Paint and select Stretch and Skew. If here are many photos, it would take ages. I then wrote a small tool for him using C#. The code is fairly simple cause .Net Framework provides huge library to use.
private void ResizePhoto()
{
//find all jpg photos in given folder
string[] jpgFiles = Directory.GetFiles(photoPath,"*.jpg");
foreach(string file in jpgFiles)
{
//load orignial photo into memory
Image image = Image.FromFile(file);
//create new photo using new size from original photo
Image newImage = new Bitmap(image,new Size(newWidth,newHeight));
//give a new file name
string newFileName = "newsize" + file;
//save new photo
newImage.Save(newFileName,System.Drawing.Imaging.ImageFormat.Jpeg);
newImage.Dispose();
image.Dispose();
}
}