在ASP.NET中如何在图片上生成图片水印?

    /// <summary>     /// 在图片上生成图片水印     /// </summary>     /// <param name="Path">原服务器图片路径</param>     /// <param name="Path_syp">生成的带图片水印的图片路径</param>     /// <param name="Path_sypf">水印图片路径</param>     public static void AddShuiYinPic(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();更多内容http://rajojia.blog.51cto.com

        image.Save(Path_syp);         image.Dispose();     } }     Default.aspx代码:  

   <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">     <title>asp.net 上传图片并作处理 水印 缩略图</title> </head> <body>   

  <form id="form1" runat="server">    <div>         <asp:FileUpload ID="FileUpload1" runat="server" BorderColor="Gray" BorderWidth="1px" />        

<asp:Button ID="Button1" runat="server" onClick="Button1_Click" Text="上传" BorderColor="Gray" BorderWidth="1px" Width="70px" /><br />        

<asp:Label ID="Label1" runat="server"></asp:Label>    </div>   

  </form> </body> </html>    

健康知识膀胱结石怎么办

posted @ 2012-06-05 11:38  网络汇集  阅读(126)  评论(0)    收藏  举报