代码如下:
---------------------------------
//加文字水印
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", 10);//设置字体大小
Brush b = new SolidBrush(Color.Black);//设置字体颜色
string addText = "99999999";
g.DrawString(addText, f, b, 1, 1);//设置坐标
g.Dispose();//保存加水印过后的图片,删除原始图片
string newPath = Request.PhysicalApplicationPath+Label3.Text+"/g9959w_"+strNewName;
image.Save(newPath);
image.Dispose();
TextBox2.Text=Label3.Text+"/g9959w_"+strNewName;
if(File.Exists(path))
{
File.Delete(path);
}
=====================================
问题是:是的gif格式不能加水印,但是jpg就可以,为什么呀?怎么改代码?
---------------------------------
//加文字水印
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", 10);//设置字体大小
Brush b = new SolidBrush(Color.Black);//设置字体颜色
string addText = "99999999";
g.DrawString(addText, f, b, 1, 1);//设置坐标
g.Dispose();//保存加水印过后的图片,删除原始图片
string newPath = Request.PhysicalApplicationPath+Label3.Text+"/g9959w_"+strNewName;
image.Save(newPath);
image.Dispose();
TextBox2.Text=Label3.Text+"/g9959w_"+strNewName;
if(File.Exists(path))
{
File.Delete(path);
}
=====================================
问题是:是的gif格式不能加水印,但是jpg就可以,为什么呀?怎么改代码?
解决方案 »
- Attempted to read or write protected memory
- asp.net GridView对某列直接能修改
- asp.net中如何将数据以json格式传给jqgrid
- ajaxpro两级联动出现错误
- asp.net控件问题
- 怎么架设自己的服务器?
- datagrid中的显示问题!!!!
- 请问:Response.Write方法与Page.RegisterStartupScript()方法有何区别?
- 【高分求指教】C#如何向Excel报表 高效批量的插入图片
- 如何用.NET实现聊天室功能???动态(激发)刷新页面??大家讨论一下。--谢谢--分数多多
- 页面判断的初级问题,求助
- 请问怎么在下拉列表中判断当前值是否为空``并且当点击时立即弹出消息提示信息..
---------------------
这个就是参数,为了少些代码,就省写了,不影响阅读吧,呵呵