I need to know how to make the web application crop an image and resize it as a thumbnail to use it later on in the application?
-
Do you want an uploaded image to be stored, only then smaller? For example, the user uploads an image 1024x768, but you store it as 800x600? – TJHeuvel Aug 17 '11 at 07:39
-
1Can you be more specific about what you want? Do you want the user to be able to upload the picture or select from a list you present them? After the user has selected the picture, you want them to be able to crop the picture so that only that portion is stored? When storing the picture do you want to store the full size picture, or only store a smaller version scaled to fit a thumbnail size (ie - 200 x 200)? – briddums Aug 17 '11 at 08:33
3 Answers
You need to write a code that uses System.Drawing classes.
Edit:
Please take a look at this thread - Resize an Image C#

- 1
- 1

- 93,659
- 19
- 148
- 186
-
that is not enough ,when the user upload any image he can corp the part he want from the image!! – HAJJAJ Aug 17 '11 at 07:34
-
1@HAJJAJ: you mean something like, for example, for the user to be able to drag and drop a rectangle on the picture and press enter and the picture to be cropped to that zone? You should specify all you need in the question title or body. – Răzvan Flavius Panda Aug 17 '11 at 07:44
If you google for "crop c#" or "resize c#" you will get lots of good tutorials. :)
For example:
Crop An Image (Bitmap) in C# or VB.NET

- 1
- 1

- 21,730
- 17
- 111
- 169
Resizing and cropping the image is relatively easy in C#, as others have pointed out. The trouble is getting the information for what parts of the image to crop to. You will need to display the image for the user, and allow them to select the area; this will most likely happen using some JavaScript.
This site has one example of how to do this, although not a very good one. I think a much slicker one could be created by using JQueryUI's draggable features, but I'll leave that exercise up to you.

- 2,877
- 18
- 18