예제 #1
0
 /// <summary>
 /// 添加水印效果
 /// </summary>
 /// <param name="fileName">输入路径</param>
 /// <param name="newfileName">输出路径</param>
 /// <param name="WaterImg">水印文件路径</param>
 /// <param name="RightSpace">水印靠近图片右边的像素</param>
 /// <param name="BottomSpace">水印靠近底边的像素</param>
 /// <param name="LucencyPercent">透明度</param>
 public static void SetWaterMark(string fileName, string newfileName, string WaterImg, int RightSpace, int BottomSpace, int LucencyPercent)
 {
     using (System.Drawing.Image image = System.Drawing.Image.FromFile(fileName))
     {
         ImageModification wm = new ImageModification();
         wm.DrawedImagePath = WaterImg;                   //水印图片
         wm.ModifyImagePath = fileName;                   //图片的路径
         wm.RightSpace      = RightSpace;                 //水印位置
         wm.BottoamSpace    = image.Height - BottomSpace; //水银位置
         wm.LucencyPercent  = LucencyPercent;             //透明度
         wm.OutPath         = newfileName;                //生成的文件名
         wm.DrawImage();
         image.Dispose();
     }
 }
예제 #2
0
 /// <summary>
 /// 添加水印效果
 /// </summary>
 /// <param name="fileName">输入路径</param>
 /// <param name="newfileName">输出路径</param>
 /// <param name="WaterImg">水印文件路径</param>
 /// <param name="RightSpace">水印靠近图片右边的像素</param>
 /// <param name="BottomSpace">水印靠近底边的像素</param>
 /// <param name="LucencyPercent">透明度</param>
 public static void SetWaterMark( string fileName, string newfileName,string WaterImg,int RightSpace,int BottomSpace,int LucencyPercent)
 {
     using (System.Drawing.Image image = System.Drawing.Image.FromFile(fileName))
     {
         ImageModification wm = new ImageModification();
         wm.DrawedImagePath = WaterImg; //水印图片
         wm.ModifyImagePath = fileName;   //图片的路径
         wm.RightSpace = RightSpace;        //水印位置
         wm.BottoamSpace = image.Height - BottomSpace;       //水银位置
         wm.LucencyPercent = LucencyPercent;          //透明度
         wm.OutPath = newfileName;         //生成的文件名
         wm.DrawImage();
         image.Dispose();
     }
 }