怎样用C#给GIF动画加上水印!
而且要加了水印后GIF动画还能动!
高手门,帮哈我呀!!
而且要加了水印后GIF动画还能动!
高手门,帮哈我呀!!
解决方案 »
- asp.net gridview绑定en_US.819数据库乱码
- 求一个c# 的邮件管理类库
- SerialPort类 连续读取不同地址 返回数据不稳定!
- 如果在windows平台下编写中小型的应用程序,用CS好还是VB好?
- 填充dataGridView的这两种方法哪一个更好?为什么
- listView如何让它显示access中的表?
- 如何做客户端的数据检索?
- 有薪请教关于网站登录,内详!
- 请进!!怎么通过设计时期的编辑器在asp.net的后置代码文件生成代码???
- 高手请进来帮小弟看一个问题!急急急急急急急急急急急急急急急急急急急急急急
- 穷菜鸟问一下WINFORM 下DATAGRID如何去等当前行数
- 求助 如何编译不安全代码
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); } }