New Message on dotNET User Group Hyd

Stamping the images with text in ASP.dot net

Reply
  Reply to Sender   Recommend Message 2 in Discussion
From: DeepakG_MSFT

Hi,
 
Try the following code snippet. It assumes that you have the image and text with you already...
 
<%@ Page language="C#" ContentType="image/jpeg"%>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
 void Page_Load(Object o, EventArgs e)
 {
  String FileName = "image1.jpg";
  String Message = "Season's Greetings";
  Color FillColor = Color.FromArgb(127,255,255,255);
        SolidBrush FillBrush = new SolidBrush(FillColor);
  Rectangle FillRectangle = new Rectangle(5,5,310,50);
  
  Font TextFont = new Font("Comic Sans MS",20);
  SolidBrush TextBrush = new SolidBrush(Color.Navy);
  StringFormat TextFormat = new StringFormat();
  TextFormat.Alignment = StringAlignment.Center;
  TextFormat.LineAlignment = StringAlignment.Center;
  System.Drawing.Image GreetingImage = System.Drawing.Image.FromFile(Server.MapPath("images") + "\\" + FileName);
  Graphics DrawingSurface = Graphics.FromImage(GreetingImage);
  DrawingSurface.FillRectangle(FillBrush, FillRectangle);
  DrawingSurface.DrawString(Message, TextFont, TextBrush, FillRectangle, TextFormat);
  Stream Output = Response.OutputStream;
  GreetingImage.Save(Output,ImageFormat.Jpeg);
 }
</script>

View other groups in this category.


Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to