用asp.net(C#)代码怎样让一张图片放大缩小啊,急啊!!!
2个回答
展开全部
int w = 100;
int h = 100;
Bitmap originBmp = new Bitmap("a.jpg");
Bitmap resizedBmp = new Bitmap(w, h);
Graphics g = Graphics.FromImage(resizedBmp);
g.DrawImage(originBmp, new Rectangle(0,0,w,h), new Rectangle(0,0,originBmp.Width,originBmp.Height), GraphicsUnit.Pixel);
resizedBmp.Save("b.jpg");
g.Dispose();
resizedBmp.Dispose();
originBmp.Dispose();
int h = 100;
Bitmap originBmp = new Bitmap("a.jpg");
Bitmap resizedBmp = new Bitmap(w, h);
Graphics g = Graphics.FromImage(resizedBmp);
g.DrawImage(originBmp, new Rectangle(0,0,w,h), new Rectangle(0,0,originBmp.Width,originBmp.Height), GraphicsUnit.Pixel);
resizedBmp.Save("b.jpg");
g.Dispose();
resizedBmp.Dispose();
originBmp.Dispose();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询