Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static ImgWaterMark Instance()
 {
     if (_instance == null)
     {
         lock (Lock)
         {
             if (_instance == null)
             {
                 _instance = new ImgWaterMark();
             }
         }
     }
     return(_instance);
 }
Beispiel #2
0
        //https://developer.qiniu.com/dora/manual/1316/image-watermarking-processing-watermark


        /// <summary>
        /// 添加图片水印
        /// </summary>
        /// <param name="sourcePath">源图片</param>
        /// <param name="waterPath">水印图片</param>
        /// <param name="dissolve">透明度,取值范围1-100,默认值为100(完全不透明)。</param>
        /// <param name="imagePosition">水印位置</param>
        /// <returns>水印图片</returns>
        public Bitmap SetWaterMark(string sourcePath, string waterPath, float dissolve = 100, ImagePosition imagePosition = ImagePosition.RigthBottom)
        {
            return(new Bitmap(ImgWaterMark.Instance().SetWaterMark(Image.FromFile(sourcePath), Image.FromFile(waterPath), dissolve, imagePosition)));
        }