As Microsoft continues to expand and openSource codeScale. ASP. NET is the most popular project on codeplex.
There is an ASP. NET Image Generation sub-project under ASP. NET webforms, which facilitates Image Processing in ASP. NET projects.
Project Introduction: ASP. NET image generation is a speedy way of generating, transforming, caching images in Asp.net
Download: http://aspnet.codeplex.com/Wiki/View.aspx? Title = image % 20 generation & referringtitle = home
. NET Framework: 3.5
CodeExample:
Default. aspx
Code
<% @ Page Language = " C # " Autoeventwireup = " True " Codefile = " Default. aspx. CS " Inherits = " _ Default " %>
<% @ Register assembly = " Microsoft. Web. generatedimage " Namespace = " Microsoft. Web " Tagprefix = " PC3 " %>
<!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 > </ Title >
</ Head >
< Body >
< Form ID = "Form1" Runat = "Server" >
< Div >
< C0: generatedimage ID = "Generatedimage1"
Runat = "Server" Imagehandlerurl = "~ /Textimagehandler. ashx" >
< Parameters >
< C0: imageparameter Name = "Hello" Value = "Text in an image" />
</ Parameters >
</ C0: generatedimage >
</ Div >
</ Form >
</ Body >
</ Html >
Textimagehandler. ashx
Code
<% @ Webhandler Language = " C # " Class = " Textimagehandler " %>
Using system;
Using system. Collections. Specialized;
Using system. drawing;
Using system. Web;
Using Microsoft. Web;
Public class textimagehandler: imagehandler {
Public textimagehandler (){
This. contenttype = system. Drawing. imaging. imageformat. PNG;
}
Public override imageinfo generateimage (namevaluecollection parameters ){
// Add image generation logic here and return an instance of imageinfo
Bitmap bit = new Bitmap (300, 60 );
Graphics gra = graphics. fromimage (BIT );
Gra. Clear (color. aliceblue );
Gra. drawstring (parameters ["hello"], new font (fontfamily. genericsansserif, 16), brushes. Black, 0, 0 );
Return new imageinfo (BIT );
}
}
Running Effect