The thumbnails generated by ASP. NET are very distorted. If the original image file is in JPG format, you can use the following program to optimize it:
Private void makeslt (string oldimagepath, string newimagepath)
...{
// Oldimagepath-source image address newimagepath
Int width = 150; // The width of the thumbnail.
Int Height = 112; // The height of the thumbnail.
Int level = 100; // the range of the thumbnail quality from 1
System. Drawing. Image oldimage = system. Drawing. image. fromfile (oldimagepath );
System. Drawing. Image thumbnailimage = oldimage. getthumbnailimage (width, height, new system. Drawing. image. getthumbnailimageabort (thumbnailcallback), intptr. Zero );
Bitmap Bm = new Bitmap (thumbnailimage );
// Processing JPG Quality Functions
Imagecodecinfo [] codecs = imagecodecinfo. getimageencoders ();
Imagecodecinfo ICI = NULL;
Foreach (imagecodecinfo Codec in codecs)
...{
If (codec. mimetype = "image/JPEG ")
ICI = codec;
}
Encoderparameters Ep = new encoderparameters ();
Ep. Param [0] = new encoderparameter (encoder. Quality, (long) level );
BM. Save (newimagepath, ici, EP );
}
From http://www.chinaaspx.com/comm/dotnetbbs/Showtopic.aspx? Forum_id = 5 & id = 243972 & ppage = 2