Jaqen H'ghar
Jaqen H'ghar

Reputation: 1879

How to change picture file dimension in C#?

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

Upvotes: 2

Views: 5864

Answers (2)

Tim Li
Tim Li

Reputation: 215

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);

Upvotes: 3

Oded
Oded

Reputation: 498904

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

See this tutorial for details.

Upvotes: 2

Related Questions