上传图片后,在图片上打上LOGO?(C#)

ysx_5 2003-11-12 10:58:37
RT

有无代码...???

谢谢
...全文
76 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
szj820 2003-12-04
  • 打赏
  • 举报
回复
up
myzig 2003-11-13
  • 打赏
  • 举报
回复
学习
siugwan 2003-11-13
  • 打赏
  • 举报
回复
学习
codecb 2003-11-13
  • 打赏
  • 举报
回复
学习
gOODiDEA 2003-11-13
  • 打赏
  • 举报
回复
参考:
上传时图片可以改大小,图上写字
hp.q 发表于 2000-11-23 16:28:36 .NET技术 ←返回版面 [快速返回]

<%@ Page Language="c#" Debug="true" Trace="true"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<html>
<script runat =server>
void UploadBtn_Click(Object sender, EventArgs e) {
String filename;
String filename1;
String[] filename2;
int q;
filename=UploadFile.PostedFile.FileName ;
filename2=filename.Split(new Char[] {'\\'});
q=filename2.GetUpperBound(0);
filename1=filename2[q];
dis.Text="上传文件名:"+filename1+"<br>";
UploadFile.PostedFile.SaveAs(Server.MapPath(filename1));
ImageEditor.Visible = true;
dis.Text+="文件大小:"+UploadFile.PostedFile.ContentLength+"字节数";
Image1.Src=filename1;
}
void UpdateBtn_Click(Object sender, EventArgs e) {
String filename1;
filename1=Image1.Src;
System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath(filename1));
System.Drawing.Image newimage = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppRGB);
Graphics g = Graphics.FromImage(newimage);
g.DrawImage(image,0,0,image.Width,image.Height);
Font f = new Font(FontType.SelectedItem.Text, Int32.Parse(FontSize.SelectedItem.Text));
Brush b = new SolidBrush(Color.Red);
g.DrawString(Caption.Text, f, b, 10, 140);
g.Dispose();
System.Drawing.Image thumbImage = newimage.GetThumbnailImage(Int32.Parse(Width.Text),Int32.Parse(Height.Text),null,0);
image.Dispose();
thumbImage.Save(Server.MapPath(filename1), ImageFormat.JPEG);
Image1.Src=filename1;
Caption.Text="";

}

</script>

<body>
<asp:label id="dis" runat=server/>
<form enctype="multipart/form-data" runat=server>

<h3>

Select File To Upload: <input id="UploadFile" type=file runat=server>

<asp:button Text="Upload Me!" OnClick="UploadBtn_Click" runat=server/>

<hr>

<asp:panel id="ImageEditor" Visible=false runat=server>

<img ID="Image1" src="" runat="server"/>

<h3>
Image Width: <asp:textbox id="Width" runat=server/>

Image Height: <asp:textbox id="Height" runat=server/> <br>

Text Caption: <asp:textbox id="Caption" runat=server/>

Caption Size: <asp:dropdownlist id="FontSize" runat=server>
<asp:listitem>14</asp:listitem>
<asp:listitem>18</asp:listitem>
<asp:listitem>26</asp:listitem>
<asp:listitem>36</asp:listitem>
<asp:listitem>48</asp:listitem>
<asp:listitem>62</asp:listitem>
</asp:dropdownlist>
Caption Font: <asp:dropdownlist id="FontType" runat=server>
<asp:listitem>黑体</asp:listitem>
<asp:listitem>仿宋</asp:listitem>
<asp:listitem>隶书</asp:listitem>
<asp:listitem>楷书</asp:listitem>
<asp:listitem>方正姚体</asp:listitem>
<asp:listitem>华文彩云</asp:listitem>
</asp:dropdownlist>

<asp:button Text="Update Image" OnClick="UpdateBtn_Click" runat=server/>

</h3>
</asp:panel>

</form>

</body>
</html>
saucer 2003-11-12
  • 打赏
  • 举报
回复
see

Creating a Watermarked Photograph with GDI+ for .NET
http://www.codeproject.com/csharp/watermark.asp

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧