public void formatImage()
{
//格式化后的图片大小
int _WIDTH = ;
int _HEIGHT = ;
SystemDrawingImageGetThumbnailImageAbort myCallback = new SystemDrawingImageGetThumbnailImageAbort(ThumbnailCallback);
SystemDrawingImage img = SystemDrawingImageFromFile(@d:\png);
//制作缩略图
int width = imgWidth;
int height = imgHeight;
double divide = (double)height / (double)width;
if (width > _WIDTH || height > _HEIGHT)
{
if (width > _WIDTH)
{
height = ConvertToInt(MathFloor(_WIDTH * divide));
width = _WIDTH;
}
if (height > _HEIGHT)
{
width = ConvertToInt(MathFloor(_HEIGHT / divide));
height = _HEIGHT;
}
SystemDrawingImage timg = imgGetThumbnailImage(width height myCallback SystemIntPtrZero);
timgSave(@d:\jpg SystemDrawingImagingImageFormatJpeg);
//下面的是保存到流中
//MemoryStream ms = new MemoryStream();
//timgSave(ms SystemDrawingImagingImageFormatJpeg);
//msClose();
}
}
public bool ThumbnailCallback()
{
return false;
}