Auto-Generate Anti-Aliased Text Images with ASP.NET

The Problem

A little bit ago, one of our clients had us redesign their website.  The new design needed to use a particular font that wasn’t a core web font.  While there are ways to embed fonts in many modern browsers, the traditional way to make sure that a block of text renders perfectly across all browsers, including older browsers like IE 6 and Netscape, is to generate an image using image manipulation software, and use that image instead of text.

Regardless of the inelegance of such a solution, one of the major problems with this approach is that any change in color, size, font, or text for any of those images requires completely recreating the image and any mouseover variations of the image.  Different CSS themes for the same site require generating and deploying completely separate sets of images for each theme.

Wouldn’t it be great if this process could be simplified or automated?

The good news is, it can!

The Solution

Each of the following images was created with the same ASP.NET script. The text and style are changed by simply changing the query string to the URL of the script.

Sample Code

The Microsoft .NET Framework has always supported basic image manipulation functionality in the System.Drawing namespace.  It is a fairly straightforward process of generating a System.Drawing.Image object that represents an anti-aliased graphical string of text.

At this point, the only thing remaining is to convert the System.Drawing.Image object into a PNG image and stream it to the client browser. There is plenty of sample code available online on that topic:


At DLS Software Studios, we want to provide you with the very best IT solutions for your business. Contact us today to discuss how Chicago IT consulting can bring cost-effective, best in class solutions to your organization. From custom software development to systems analysis, we’ve got you covered. While we are located in the Chicago area, we take on projects throughout the country. Any project, anywhere, anytime – We’ve got the solution for you.

Request a Free Quote

Email us below or call us at

Request a Free Quote

Email us below or call us at 866-313-0106

Request a Free Quote

Email us below or call us at 866-313-0106
  • This field is for validation purposes and should be left unchanged.

Case Study

DLS Software Studios has continually grown it's highly experienced team of software engineers and designers. We have built a good track record of realizing and fulfilling the needs and visions of our clients. Case Study