C# 如何去水印? C#如何去除图片上的水印呢?该图片是一文章图片,上面的水印是有特征的1.随机在各个段落之间的空行中出现,2.水印文字为楷体或宋体麻烦有经验的人给个解决思路或参考文档,谢谢, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面的代码中,加文字水印和加图片水印的代码不能共存我是为了方便显示才写在一块的 private void Btn_Upload_Click(object sender, System.EventArgs e) { if(UploadFile.PostedFile.FileName.Trim()!="") { //上传文件 string extension = Path.GetExtension(UploadFile.PostedFile.FileName).ToUpper(); string fileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); string path = Server.MapPath(".") + "/UploadFile/" + fileName + extension; UploadFile.PostedFile.SaveAs(path); //加文字水印,注意,这里的代码和以下加图片水印的代码不能共存 System.Drawing.Image image = System.Drawing.Image.FromFile(path); Graphics g = Graphics.FromImage(image); g.DrawImage(image, 0, 0, image.Width, image.Height); Font f = new Font("Verdana", 32); Brush b = new SolidBrush(Color.White); string addText = AddText.Value.Trim(); g.DrawString(addText, f, b, 10, 10); g.Dispose(); //加图片水印 System.Drawing.Image image = System.Drawing.Image.FromFile(path); System.Drawing.Image copyImage = System.Drawing.Image.FromFile( Server.MapPath(".") + "/Alex.gif"); Graphics g = Graphics.FromImage(image); g.DrawImage(copyImage, new Rectangle(image.Width-copyImage.Width, image.Height-copyImage.Height, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, GraphicsUnit.Pixel); g.Dispose(); //保存加水印过后的图片,删除原始图片 string newPath = Server.MapPath(".") + "/UploadFile/" + fileName + "_new" + extension; image.Save(newPath); image.Dispose(); if(File.Exists(path)) { File.Delete(path); } Response.Redirect(newPath); } }来自:http://www.cnblogs.com/index/archive/2004/10/20/54498.aspx 去水印 很难实现的 你想下 你用ps去去除都麻烦 更不要说写程序来去除了新群DotNet Programmer 群号112850311欢迎DotNet程序员的加入,来吧,我们共同打造一个好的学习交流场所,我们真诚欢迎您的加入。 可以写个photoshop action来进行处理 我也在想这个事,只要水印是有规律特征的,程序应该是可以去的,曾看到一个贴,说用到水印提取算法、高斯算法、USM算法等,一下先。至少规律非常清楚的话可以用ps的批处理完成。 还真有拿电影说事的,电影里黑客靠猜密码都能掌握核按钮,你也信,水印加到图片上后就成为一张图片了,jpg是不分层的,你只能用图像识别算法去大致猜测水印的位置,如果水印加的时候还来点随机变形、调色、噪点什么的,就几乎是不可分辨的。这也就是网站验证码的原理。 当前技术下,连PS都做不到,更不要说C#了。最恨下某些图的时候打水印。唉。 asp.net调用外部DLL 请大家帮我实现一个功能。 介绍几个CSS实例网站 DataGrid显示的问题。 江湖救急!上传服务器的站点事件全部脱离!不能响应! 为什么在模版列里添加dropdownlist以后就看不到 找工作或想跳槽的请进 asp.net chart添加图列说明 如何对查询结果进行分页? jQuery执行ajax传多个参数到一般处理程序报错,这个一般处理程序并没有进去 高手帮忙解决下QQ邮箱发邮件的问题 .net C# 接口 操纵FTP 操作超时问题
我是为了方便显示才写在一块的
private void Btn_Upload_Click(object sender, System.EventArgs e)
{
if(UploadFile.PostedFile.FileName.Trim()!="")
{
//上传文件
string extension = Path.GetExtension(UploadFile.PostedFile.FileName).ToUpper();
string fileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
string path = Server.MapPath(".") + "/UploadFile/" + fileName + extension;
UploadFile.PostedFile.SaveAs(path); //加文字水印,注意,这里的代码和以下加图片水印的代码不能共存
System.Drawing.Image image = System.Drawing.Image.FromFile(path);
Graphics g = Graphics.FromImage(image);
g.DrawImage(image, 0, 0, image.Width, image.Height);
Font f = new Font("Verdana", 32);
Brush b = new SolidBrush(Color.White);
string addText = AddText.Value.Trim();
g.DrawString(addText, f, b, 10, 10);
g.Dispose(); //加图片水印
System.Drawing.Image image = System.Drawing.Image.FromFile(path);
System.Drawing.Image copyImage = System.Drawing.Image.FromFile( Server.MapPath(".") + "/Alex.gif");
Graphics g = Graphics.FromImage(image);
g.DrawImage(copyImage, new Rectangle(image.Width-copyImage.Width, image.Height-copyImage.Height, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, GraphicsUnit.Pixel);
g.Dispose(); //保存加水印过后的图片,删除原始图片
string newPath = Server.MapPath(".") + "/UploadFile/" + fileName + "_new" + extension;
image.Save(newPath);
image.Dispose();
if(File.Exists(path))
{
File.Delete(path);
} Response.Redirect(newPath);
}
}
来自:http://www.cnblogs.com/index/archive/2004/10/20/54498.aspx
欢迎DotNet程序员的加入,来吧,我们共同打造一个好的学习交流场所,我们真诚欢迎您的加入。