Beanie posted on May 1, 2009 16:28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Text;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
public partial class textgif : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Load the Image to be written on.
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("gen_img.jpg"));
Graphics graphicImage = Graphics.FromImage( bitMapImage );
//Smooth graphics is nice.
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
//Write your text.
SolidBrush oBrushWrite = new SolidBrush(Color.Navy);
graphicImage.DrawString("Welcome to BeanEngineering",
new Font("Arial", 22, FontStyle.Italic),
oBrushWrite, new Point(0, 0));
//Set the content type
Response.ContentType = "image/gif";
//Save the new image to the response output stream.
bitMapImage.Save(Response.OutputStream, ImageFormat.Gif);
//Clean house.
graphicImage.Dispose();
bitMapImage.Dispose();
}
}

Posted in: Development , Development - ASP  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

Page List

Search Blog

Tag Cloud

Recent Comments

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 Beanie