title: Any suggestions for optimizing this code?
body: <p>I have written a code from the answer given <a href="https://stackoverflow.com/questions/4967937/32bit-rgb-bmp-to-24bit-rgb-bmp-in-c-problem">here</a></p>
  
  <p>My sample code is as follows</p>
  
  <pre><code>void Process(int i)
  {
      input = (Bitmap)Bitmap.FromFile(@"filepath.bmp");
  
      Bitmap temp = new Bitmap(input.Width, input.Height, 
                               PixelFormat.Format24bppRgb);
      Graphics g = Graphics.FromImage(temp);
      g.Clear(Color.Red);
      g.DrawImage(input, Point.Empty);
  
      temp.Save(stream, ImageFormat.Bmp);
      //I need this stream thats further processing
  }
  
  void timer_Ex()
  {
      int i = 11;
      for (; ; )
      {
        if (i == 335) break;
        else
        {
           st.Start();
           Process(i);
           st.Stop();    
           Console.WriteLine(st.ElapsedMilliseconds.ToString());
              //This time is more than the time in which thread sleeps
           st.Reset();                       
           Thread.Sleep(70);                     
           i++;
         }
     }
  }
  </code></pre>
  
  <p>So I am trying to convert image from rgb32 to rgb24. But it takes more time on processing than the time in which thread sleeps. Its just a sample code. So just help me with this question
  "How can i optimize process(int i) to execute in 20 ms or less than 100 ms?"</p>