ASP.Net Image / picture Cropping (Resize) using stream in C#
namespace:
using System.Drawing;
using System.Drawing.Imaging;
Method:-
protected void UploadImage(HttpPostedFile file)
{
string fileName = file.FileName.Substring(file.FileName.LastIndexOf('\\') + 1);
using (System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream))
using (Bitmap bitmap = new Bitmap(image, 640, 480)) {
bitmap.Save(MapPath("~/Images/product/zoom/" + FileUploadThumb.FileName.Trim()), image.RawFormat);
}}