asp.Net 一些常用的方法和类(11)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-17 14:40 点击:次
Graphics g = Graphics.FromImage(img);//通过图片对象创建画布
g.DrawImage(watering, new Rectangle(img.Width - watering.Width, img.Height - watering.Height, watering.Width, watering.Height), 0, 0, watering.Width, watering.Height, GraphicsUnit.Pixel);//画图
context.Response.ContentType = "image/jpeg";//设置图片的格式
img.Save(context.Response.OutputStream, ImageFormat.Jpeg);//把图片保存在输出流中
g.Dispose();//销毁画布
img.Dispose();//销毁图片
context.Response.End();
}
else
{
Image defaultimg = Image.FromFile(context.Server.MapPath("~/themes/images/water.jpg"));//通过图片路径得到默认图片对象
Image watering = Image.FromFile(context.Server.MapPath("~/themes/images/water.jpg"));//得到数字水印图片
Graphics g = Graphics.FromImage(defaultimg);//通过图片对象创建画布
g.DrawImage(watering, new Rectangle(defaultimg.Width - watering.Width, defaultimg.Height - watering.Height, watering.Width, watering.Height), 0, 0, watering.Width, watering.Height, GraphicsUnit.Pixel);//画图
context.Response.ContentType = "image/jpeg";//设置图片的格式
defaultimg.Save(context.Response.OutputStream, ImageFormat.Jpeg);
g.Dispose();
defaultimg.Dispose();
context.Response.End();
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>
今日头条
更多>>您可能感兴趣的文章
- 用OpenXml在文档的尾部添加一个Rich Text Content Con
- Spring.Net学习系列一: 统一异常处理
- ASP.NET之Gridview图解(1)
- 向Excel文档中嵌入VBA控件和UserForm并显示
- ASP.NET生成高质量缩略图通用函数(c#代码)
- ASP.NET FormsAuthentication跨站点登录时绝对地址返
- 步步为营 SharePoint 开发学习笔记系列&nb
- Request.Cookies 和 Response.Cookies 的区别
- 使用ASP.NET MVC3+EF+Jquery制作文字直播系统(一
- ASP.net页面中请求远程Web站点



