Asp.net outputs png 32-bit images with transparent alpha.
// Pngtest.htm
<Html>
<Head> <Body bgColor = "gray">
</Body>
</Html>
// Png. ashx
Using System. Web;
Using System. Drawing;
Public class Png: IHttpHandler {
Public void ProcessRequest (HttpContext context ){
HttpResponse Response = context. Response;
Bitmap bmp = new Bitmap (392, 72 );
Graphics g = Graphics. FromImage (bmp );
G. Clear (System. Drawing. Color. Gray );
G. DrawString ("This is 32bit png .",
New Font ("verdana bold", 14f ),
Brushes. HotPink, 0f, 0f );
G. Dispose ();
Bmp. MakeTransparent (System. Drawing. Color. Gray );
System. IO. MemoryStream MemStream = new System. IO. MemoryStream ();
Bmp. Save (MemStream, System. Drawing. Imaging. ImageFormat. Png );
Bmp. Dispose ();
Response. Clear ();
Response. ContentType = "image/PNG ";
MemStream. WriteTo (Response. OutputStream );
MemStream. Close ();
}
Public bool IsReusable {get {return false ;}}
}