惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
美团技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 杨勇平

Oracle 的十八般武艺 台球常用术语解释以及英文对照 b/s开发常用javaScript技术 GridView的小技巧(1)--如何实现鼠标划过改变GridView的行背景色 HTTP状态码及其含义 Split函数详解 - 杨勇平 - 博客园 ASP.NET分页组件学与用——教学篇 C#常用函数和方法集汇总 javascipt分页函数 Ajax实现无刷新三联动下拉框 慢慢的溜达 程序员贬值是个骗局! 警惕 男人难逃的五大"诱惑" 宽容 享受 人生中二十五件最重要的事情 asp.net+JSON+AJAX(基于prototype1.4)做无刷新的2级DropDownList 无题 证明题
图片加水印 - 杨勇平 - 博客园
杨勇平 · 2006-12-31 · via 博客园 - 杨勇平

加图片水印:

System.Drawing.Image image

image=System.Drawing.Image.FromFile(path);
    System.Drawing.Image copyImage = System.Drawing.Image.FromFile( Server.MapPath("upload\\126.JPG") );
    Graphics g = Graphics.FromImage(image);
    g.DrawImage(copyImage, new Rectangle(0,0, copyImage.Width, copyImage.Height),  0, 0,  copyImage.Width, copyImage.Height, GraphicsUnit.Pixel);
    g.Dispose();
    image.Save(Server.MapPath(newPath)+System.DateTime.Now.ToString("yyyyMMddHmmss")+exName);
    image.Dispose();

加文字水印:

   image=System.Drawing.Image.FromFile(path);
   Graphics g= Graphics.FromImage(image);
   newimage=image.GetThumbnailImage(smallImage_Width,smallImage_Height,callb,new System.IntPtr());
   Font f=new Font(watermark_text_FontName,watermark_text_FontSize,FontStyle.Bold);
   SolidBrush b=new SolidBrush(Color.Red);
   g.DrawString(watermark_text,f,b,10,10);
   g.Dispose();
   image.Save(httpcontent.Server.MapPath(newPath)+System.DateTime.Now.ToString("yyyyMMddHmmss")+exName );