views:

25

answers:

2

Hi, I am working a mvc web app. I upload a image to use it as system logo. Now if I select image and upload it, it can be replaced easily until image file is not of large dimesion. For file with large dimension i need to reduce its size to some smaller size to make it look like a system logo. Preferable size for my logo is 100x75. How can I reduce the file dimesion? THanks, kapil

A: 

You can use the classes that are in the System.Drawing namespace.

See this tutorial for details.

Oded
The code snippet will likely bring your server down (or at least cause worker process recycling) on a high-traffic site, since it doesn't take care of releasing all the used GDI+ objects right away.
Lucero
A: 

try this. I found it in the msdn, and it works.

Bitmap map = new Bitmap(Image.FromFile("F:\\1.jpg"), new Size(20, 20));
map.Save("F:\\5.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
Tim Li