当前位置: 编程技术>.net/c#/asp.net
c#图片添加水印的实例代码
来源: 互联网 发布时间:2014-10-22
本文导语: 代码如下:using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;using System.IO;namespace ImageDrawing{ /// /// 图片修改类,主要是用来保护图片版权的 /// public class ImageModification { #region "member fields" private string mo...
代码如下:
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
namespace ImageDrawing
{
///
/// 图片修改类,主要是用来保护图片版权的
///
public class ImageModification
{
#region "member fields"
private string modifyImagePath=null;
private string drawedImagePath=null;
private int rightSpace;
private int bottoamSpace;
private int lucencyPercent=70;
private string outPath=null;
#endregion
public ImageModification()
{
}
#region "propertys"
///
/// 获取或设置要修改的图像路径
///
public string ModifyImagePath
{
get{return this.modifyImagePath;}
set{this.modifyImagePath=value;}
}
///
/// 获取或设置在画的图片路径(水印图片)
///
public string DrawedImagePath
{
get{return this.drawedImagePath;}
set{this.drawedImagePath=value;}
}
///
/// 获取或设置水印在修改图片中的右边距
///
public int RightSpace
{
get{return this.rightSpace;}
set{this.rightSpace=value;}
}
//获取或设置水印在修改图片中距底部的高度
public int BottoamSpace
{
get{return this.bottoamSpace;}
set{this.bottoamSpace=value;}
}
///
/// 获取或设置要绘制水印的透明度,注意是原来图片透明度的百分比
///
public int LucencyPercent
{
get{return this.lucencyPercent;}
set
{
if(value>=0&&value