最近在给公安系统做系统,需要在图片上打上水银等等,好吧直接看代码
protected void SetPicDescription(string filePath)
{
if (System.IO.File.Exists(filePath))//看该路径下图片是否存在
{
string strDescription = "公安部水印测试";//文字描述
System.IO.MemoryStream ms = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(filePath));
Image image = Image.FromStream(ms);
Graphics g = Graphics.FromImage(image);
GraphicsPath gp = new GraphicsPath();
//画图形填充区域开始
&n

在为公安系统开发时,需要在图片上添加水印和矩形标记。以下C#代码展示了如何实现这一功能,包括创建文字水印和填充矩形区域。通过Graphics对象进行绘图,使用GraphicsPath创建矩形,并用SolidBrush填充颜色。最后保存处理后的图片到文件。

2285

被折叠的 条评论
为什么被折叠?



