给一个页面放一个image 怎么在上面添加:公司名称+公司logo的水印效果

解决方案 »

  1.   

    你制作个这样的image不就行了?
      

  2.   

    用DIV做一个层覆盖过上面,或者将你的图片设成DIV的背景
      

  3.   

    http://blog.csdn.net/groupliu/archive/2007/04/06/1554529.aspx
    我照着这个做,可以实现,你自己去看看吧
      

  4.   


    /**/
            /// <summary>
            /// 在图片上增加文字水印
            /// </summary>
            /// <param name="Path">原服务器图片路径</param>
            /// <param name="Path_sy">生成的带文字水印的图片路径</param>
            protected void AddWater(string Path, string Path_sy)
            {
                string addText = "51aspx.com";
                System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
                System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
                g.DrawImage(image, 0, 0, image.Width, image.Height);
                System.Drawing.Font f = new System.Drawing.Font("Verdana", 60);
                System.Drawing.Brush b = new System.Drawing.SolidBrush(System.Drawing.Color.Green);            g.DrawString(addText, f, b, 35, 35);
                g.Dispose();            image.Save(Path_sy);
                image.Dispose();
            }        /**/
            /// <summary>
            /// 在图片上生成图片水印
            /// </summary>
            /// <param name="Path">原服务器图片路径</param>
            /// <param name="Path_syp">生成的带图片水印的图片路径</param>
            /// <param name="Path_sypf">水印图片路径</param>
            protected void AddWaterPic(string Path, string Path_syp, string Path_sypf)
            {
                System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
                System.Drawing.Image copyImage = System.Drawing.Image.FromFile(Path_sypf);
                System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
                g.DrawImage(copyImage, new System.Drawing.Rectangle(image.Width - copyImage.Width, image.Height - copyImage.Height, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, System.Drawing.GraphicsUnit.Pixel);
                g.Dispose();            image.Save(Path_syp);
                image.Dispose();
            }        protected void Button2_Click(object sender, EventArgs e)
            {
                //自动保存远程图片
                    WebClient client = new WebClient();
                    //备用Reg:<img.*?src=([\"\'])(http:\/\/.+\.(jpg|gif|bmp|bnp))\1.*?>
                    Regex reg = new Regex("IMG[^>]*?src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|'(?<1>[^\']*)')", RegexOptions.IgnoreCase);
                    MatchCollection m = reg.Matches(TextBox1.Text);                foreach (Match math in m)
                    {
                        string imgUrl = math.Groups[1].Value;                    //在原图片名称前加YYMMDD重名名并上传                    Regex regName = new Regex(@"\w+.(?:jpg|gif|bmp|png)", RegexOptions.IgnoreCase);                    string strNewImgName = DateTime.Now.ToShortDateString().Replace("-", "") + regName.Match(imgUrl).ToString();                    try
                        {
                            //保存图片
                            client.DownloadFile(imgUrl, Server.MapPath("ImgUpload/Auto/" + strNewImgName));                    }
                        catch
                        {
                        }
                        finally
                        {                    }                client.Dispose();
                }            Response.Write("<script>alert('远程图片保存成功,保存路径为ImgUpload/auto')</script>");        }
      

  5.   

    静态图片简单,用Image类就可以了
    动态图片麻烦一些,像gif
      

  6.   


      /// <summary>
            /// 在图片上增加文字水印
            /// </summary>
            /// <param name="Path">原服务器图片路径</param>
            /// <param name="Path_sy">生成的带文字水印的图片路径</param>
            protected void AddWater(string Path, string Path_sy)
            {
                string addText = "123";
                System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
                System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
                g.DrawImage(image, 0, 0, image.Width, image.Height);
                System.Drawing.Font f = new System.Drawing.Font("Verdana", 60);
                System.Drawing.Brush b = new System.Drawing.SolidBrush(System.Drawing.Color.Green);            g.DrawString(addText, f, b, 35, 35);
                g.Dispose();            image.Save(Path_sy);
                image.Dispose();
            }        /**/
            /// <summary>
            /// 在图片上生成图片水印
            /// </summary>
            /// <param name="Path">原服务器图片路径</param>
            /// <param name="Path_syp">生成的带图片水印的图片路径</param>
            /// <param name="Path_sypf">水印图片路径</param>
            protected void AddWaterPic(string Path, string Path_syp, string Path_sypf)
            {
                System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
                System.Drawing.Image copyImage = System.Drawing.Image.FromFile(Path_sypf);
                System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
                g.DrawImage(copyImage, new System.Drawing.Rectangle(image.Width - copyImage.Width, image.Height - copyImage.Height, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, System.Drawing.GraphicsUnit.Pixel);
                g.Dispose();            image.Save(Path_syp);
                image.Dispose();
            }