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
2 Answers
You can use the classes that are in the System.Drawing namespace.
See this tutorial for details.
2 Comments
Lucero
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.
Lilith River
Use the imageresizing.net library. It's 1 line of code to use, and < 200K added to your assembly. And it avoids the 29+ pitfalls in .NET image resizing.