int oldh = img.height;
int oldw = img.width;
int newh,neww;
double h1 = oldh*1.0/h;
double w1 = oldw*1.0/w;
double f = (h1>w1)? h1:w1;
if(f < 1.0)
{
newh = oldh;
neww = oldw;
}
else
{
newh = (int)(oldh/f);
neww = (int)(oldw/f);
}
system.drawing.image mythumbnail = img.getthumbnailimage(neww, newh, mycallback, intptr.zero);
mythumbnail.save(newfile, system.drawing.imaging.imageformat.jpeg);
img.dispose();
mythumbnail.dispose();
}
private bool thumbnailcallback()
{
return false;
}
新闻热点
疑难解答