The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: How to make image thumbnail using ASP.NET(C#)
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

abbasfisal mPosted Aug 30, 2013, 5:03 AM
Tnx Very Much :D!
milad HATAMPosted Aug 3, 2013, 4:00 PM
thanks man that was awesome ! ;)
sabdhi naikPosted Apr 10, 2012, 1:36 AM
I want to generate a thumbnail image for video can you plz any one help.
sabdhi naikPosted Apr 10, 2012, 1:36 AM
I want to generate a thumbnail image for video can you plz any one help.
ghouse pashaPosted Jul 7, 2011, 6:41 PM
Nice article Thanks you very much
mohdfaizan khanPosted Sep 29, 2010, 2:26 AM
actually i want, how to store number of image in a database and how to retriew it byusing thumnails if u help me in this topic i really thanksfull to u. if u send me a demo project in my mail thats is better for me my mail id is : [email protected]
mohdfaizan khanPosted Sep 29, 2010, 2:20 AM
i really thanksfull to u ths code is helping me so much but i want how to store in a data base and hoe to retriew the image from the database
drug writePosted May 20, 2010, 3:45 AM
Hi Raj this is good article. If any one not that much into coding. i found a free thumbnail creator "DLL". at http://aspspider.net/deeven/
Jason TehPosted Apr 21, 2009, 3:34 AM
Hello Raj; This is a very nice article. I'm very new to c# programming and web design. I'm trying to design a website where the user can upload their photos for displaying. I was wondering with the sample coding that you've provided:- 1. How can i rename the image? 2. How can i link the image to the user? 3. How to control the image upload to four pictures only (Per User)? 4. How to store the image path to the database (SQL 2008 Express) base on user? Hope that you can guide me on this asap. Thank you very much.
George MiscalencueditedPosted Apr 9, 2009, 10:56 AMEdited Apr 9, 2009, 10:58 AM
@Kelly: The article is ok. It is not complete, but is ok. This can be used safely ONLY if we add two more lines of code: i.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone); i.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone); By fliping the image twice we get a new image identical with the original one but without the embedded thumbnail. Now the thumbnail is in a very good quality. Please check this article for more details: http://smartdev.wordpress.com/2009/04/09/generate-image-thumbnails-using-aspnetc/ This is the only solution I know (or variations of it). Do you know a better one?
chen danPosted Mar 24, 2009, 12:43 AM
This is what I want! thanks!
Former membereditedPosted Jan 19, 2009, 8:09 AMEdited Jan 19, 2009, 8:11 AM
1) No error handling. If something goes wrong, that 2.5MB bitmap will be stuck in memory. It's important to use using{}! 2) Terrible thumbnail quality... Use DrawImage, and set compositing and resampling quality to high. 3) Huge resulting image size (Set ImageCodecParamaters, please!) 4) Inflexible - All files are in one directory, and only one size of each is supported. Every few weeks somebody writes a new image resizing tutorial with new, unique problems. Every time, every example, either security, performance, or flexibility is compromised. If you want image resizing that just works, I'd recommend this well-tested, open-source image module. http://nathanaeljones.com/products/asp-net-image-resizer/ The $70 'download fee' is well worth the stable and refined code. Building an image resizer looks deceptively easy at first glance, but preventing it from being a denial-of-service vector, making it fast enough for enormous product catalogs, and making it flexible enough to handle e multiple versions of any image is quite time-consuming.
harun tahaPosted Jan 18, 2009, 2:09 AM
I agree with Kelly. You should not use GetThumbnailImagemethod if you want high quality thumbnails. Also, you can use System.IO.File.Extension property instead of using PostedFile.FileName.LastIndexOf stuff.
Kelly StuardeditedPosted Jan 16, 2009, 1:36 PMEdited Jan 16, 2009, 1:54 PM
I have seen this example before and highly recommend against using it. Let's look at the remarks section from the Image.GetThumbnailImage method... "If the Image contains an embedded thumbnail image, this method retrieves the embedded thumbnail and scales it to the requested size. If the Image does not contain an embedded thumbnail image, this method creates a thumbnail image by scaling the main image. "The GetThumbnailImage method works well when the requested thumbnail image has a size of about 120 x 120 pixels. If you request a large thumbnail image (for example, 300 x 300) from an Image that has an embedded thumbnail, there could be a noticeable loss of quality in the thumbnail image. It might be better to scale the main image (instead of scaling the embedded thumbnail) by calling the DrawImage method." In other words .... if you upload an image that has a 25x25 preview and scale it to 100x100 you will have a noticable loss in quality, even if the original image was 1,000x1,000. There are alternate ways of scaling an existing image that will give better, more consistant results.
Abhishek ChandakPosted Dec 18, 2008, 12:10 AM
Hi Raj, Very Nice Program.. Can it be possible to rate that uploaded picture. And after rating it will be shown on mouse over????