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);
tomz
Member
624 Points
162 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>