System.Drawing.Image image = System.Drawing.Image.FromFile(url+"/"+filename);
int srcWidth = image.Width;
int thumbWidth;
int srcHeight = image.Height;
int thumbHeight = 440;
Bitmap bmp = new Bitmap(thumbWidth, thumbHeight);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmp);
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
System.Drawing.Rectangle rectDestination = new
System.Drawing.Rectangle(0, 0, thumbWidth, thumbHeight);
gr.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel);
string newfilename = filename.Substring(0, filename.LastIndexOf('.'))+reference;
string fileExt=filename.Substring(filename.LastIndexOf('.'));
bmp.Save(url + "\\" + newfilename + fileExt);
bmp.Dispose();
image.Dispose();