While helping out a friend with a picture gallery for a web application, I Googled some useful C# code for creating thumbnail images using the Image class out of the System.Drawing namespace (not to be confused with the Image web control class out of System.Web.UI.WebControls.)
http://www.c-sharpcorner.com/UploadFile/mahesh/thumbnail08072007131100PM/thumbnail.aspx
Since I didn't need the image save in a stream, I simplified the code to save it to the root of my web application with this:
using (Image img = Image.FromFile(Server.MapPath("~/image.jpg")))
{
using (Image thumb = img.GetThumbnailImage(50, 50, null, new IntPtr()))
{
thumb.Save(Server.MapPath("~/image_thumb.jpg"));
}
}
My friend was pleased, except for the fact that his application uses VB.NET. No big deal, I came up with this:
Dim img As Image = Image.FromFile(Server.MapPath("~/image.jpg"))
Dim thumb As Image = img.GetThumbnailImage(50, 50, Nothing, New IntPtr())
thumb.Save(Server.MapPath("~/image_thumb.jpg"))