Hi, I have a simple method in a class to create a thumbnail during image upload. However, the thumbnail created is blurry, like a photo losing its focus. I thought that it could the some errors in the code. Would anybody know why? The code is listed below.
Thanks for your help.
<code>
private bool ThumbnailCallback()
{
return false;
}
public void CreateThumbnailImage(string originalImagePath,
string thumbnailImagePath,
int thumbnailWidth,
int thumbnailHeight)
{
try
{
System.Drawing.
Image.GetThumbnailImageAbort MyCallback =
new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
//Create a copy of the image with a different size
Bitmap MyBitmap =
new Bitmap(originalImagePath);
I know we were doing the resize and found the thumbnails very blurry, only with images from a digital camera, because the resizing was getting done on teh stored thumbnail in the picture.
Thanks for the information. The suggestion in the article is certainly a good way to resolve this problem. I also did some search on internet and found another article:
http://west-wind.com/weblog/posts/283.aspx which creates a thumbnail using different methodology. This also generates a clean image.
tomz
Member
624 Points
161 Posts
Why the thumbnail is blurry?
Nov 08, 2006 03:42 PM|LINK
Hi, I have a simple method in a class to create a thumbnail during image upload. However, the thumbnail created is blurry, like a photo losing its focus. I thought that it could the some errors in the code. Would anybody know why? The code is listed below. Thanks for your help.
<code>
private bool ThumbnailCallback(){
return false;}
public void CreateThumbnailImage(string originalImagePath, string thumbnailImagePath, int thumbnailWidth, int thumbnailHeight){
try{
System.Drawing.
Image.GetThumbnailImageAbort MyCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); //Create a copy of the image with a different size Bitmap MyBitmap = new Bitmap(originalImagePath);System.Drawing.
Image MyThumbnail = MyBitmap.GetThumbnailImage(thumbnailWidth, thumbnailHeight, MyCallback, IntPtr.Zero);MyBitmap.Dispose();
MyThumbnail.Save(thumbnailImagePath);
MyThumbnail.Dispose();
}
catch (Exception ex){
throw ex;}
}
</code>misterP
Member
55 Points
11 Posts
Re: Why the thumbnail is blurry?
Nov 16, 2006 01:40 AM|LINK
suggest you check this out
read the bit about Resizing Images that Already Include Thumbnails
http://aspnet.4guysfromrolla.com/articles/012203-1.2.aspx
I know we were doing the resize and found the thumbnails very blurry, only with images from a digital camera, because the resizing was getting done on teh stored thumbnail in the picture.
thx
tomz
Member
624 Points
161 Posts
Re: Why the thumbnail is blurry?
Nov 16, 2006 01:18 PM|LINK
Thanks for the information. The suggestion in the article is certainly a good way to resolve this problem. I also did some search on internet and found another article: http://west-wind.com/weblog/posts/283.aspx which creates a thumbnail using different methodology. This also generates a clean image.
Thanks again!
Tom
SLORider
Member
66 Points
20 Posts
Re: Why the thumbnail is blurry?
Nov 26, 2006 02:37 AM|LINK