net生成缩略图代码,是整张图片缩小,不是裁剪多大多大的图片
1个回答
展开全部
见代码strOldPic是旧图片路径,strNewPic是输出小图路径,后面俩参数应该不用解释了。。
private void SmallPic(string strOldPic, string strNewPic, int intWidth, int intHeight)
{
System.Drawing.Bitmap objPic, objNewPic;
try
{
objPic = new System.Drawing.Bitmap(strOldPic);
objNewPic = new System.Drawing.Bitmap(objPic, intWidth, intHeight);
objNewPic.Save(strNewPic);
}
catch (Exception exp)
{ throw exp; }
finally
{
objPic = null;
objNewPic = null;
}
}
private void SmallPic(string strOldPic, string strNewPic, int intWidth, int intHeight)
{
System.Drawing.Bitmap objPic, objNewPic;
try
{
objPic = new System.Drawing.Bitmap(strOldPic);
objNewPic = new System.Drawing.Bitmap(objPic, intWidth, intHeight);
objNewPic.Save(strNewPic);
}
catch (Exception exp)
{ throw exp; }
finally
{
objPic = null;
objNewPic = null;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询