Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Posts Tagged ‘dynamic’

How to generate a bitmap dynamically in ASP.NET?

Posted by Paul on October 12, 2010

There are two steps in this process

Step1: Create the bitmap dynamically

private Bitmap GetDynamicBitmap()


Bitmap bitmap = new Bitmap(100, 100);

      Graphics graphics = Graphics.FromImage(bitmap);

      graphics.DrawString("Dynamic Bitmap", new Font("Calibri", 14, FontStyle.Bold), Brushes.Black,

      new PointF(10, 10));


      return bitmap;


Step2: Set the http response to bitmap

Bitmap bitmap = GetDynamicBitmap();

context.Response.ContentType = "image/bmp";

bitmap.Save(context.Response.OutputStream, ImageFormat.Bmp);


Posted in C# | Tagged: , , | Leave a Comment »