Home » Posts tagged "upload and resize image asp.net"

Tag Archives: upload and resize image asp.net

Simple Method to Resize Image in C#

Resizing image is a important part of software development. It enables us to reduce size dynamically while upload an image. Below is method to resize image in C# Asp.net. public void ResizeImage(string sSourceImageFileName, string sDestinationImageFileName, int iWidth, int iHeight) { Size oSize = new Size(iWidth, iHeight); Bitmap oBitmap = new Bitmap((Bitmap)Image.FromFile(sSourceImageFileName), oSize); oBitmap.Save(sDestinationImageFileName, System.Drawing.Imaging.ImageFormat.Png); oBitmap.Dispose(); } Add the above method in a class Imagecl.cs. Below is the usage of above method in ASP.net. Usage ImageUpload.aspx <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”ImageUpload.aspx.cs” [...]

Tags: , , ,