title: C# images cropping,splitting,saving
body: <p>as stated in subject, i have an image:</p>
  
  <pre><code>    private Image testing;
      testing = new Bitmap(@"sampleimg.jpg");
  </code></pre>
  
  <p>I would like to split it into 3 x 3 matrix meaning 9 images in total and save it.Any tips or tricks to do this simple? I'm using visual studios 2008 and working on smart devices. Tried some ways but i can't get it. This is what i tried:</p>
  
  <pre><code>        int x = 0;
          int y = 0;
          int width = 3;
          int height = 3;
  
  
          int count = testing.Width / width;
          Bitmap bmp = new Bitmap(width, height);
  
  
          Graphics g = Graphics.FromImage(bmp);
  
  
          for (int i = 0; i &lt; count; i++)
          {
              g.Clear(Color.Transparent);
              g.DrawImage(testing, new Rectangle(0, 0, width, height), new Rectangle(x, y, width, height), GraphicsUnit.Pixel);
              bmp.Save(Path.ChangeExtension(@"C\AndrewPictures\", String.Format(".{0}.bmp",i)));
              x += width;
          } 
  </code></pre>