I tried your link and I did Crop height and weight of image.
Nw I want to save both parts of images in folder.
I write code for crop image is following-
protected void Button1_Click(object sender, EventArgs e)
{
// Get the inputs.
int wid = int.Parse("800");
int hgt = int.Parse("1000");
Bitmap bm = new Bitmap(FileUpload1.PostedFile.InputStream); ;
// Start splitting the Bitmap.
string piece_name =
Path.GetFileNameWithoutExtension("photos/img1");
Bitmap piece = new Bitmap(wid, hgt);
Rectangle dest_rect = new Rectangle(0, 0, wid, hgt);
using (Graphics gr = Graphics.FromImage(piece))
{
int num_rows = bm.Height / hgt;
int num_cols = bm.Width / wid;
Rectangle source_rect = new Rectangle(0, 0, wid, hgt);
for (int row = 0; row < num_rows; row++)
{
source_rect.X = 0;
for (int col = 0; col < num_cols; col++)
{
// Copy the piece of the image.
gr.DrawImage(bm, dest_rect, source_rect, GraphicsUnit.Pixel);
// Save the piece.
string filename = piece_name +
row.ToString("00") +
col.ToString("00") + ".bmp";
piece.Save(filename, ImageFormat.Bmp);
// Move to the next column.
source_rect.X += wid;
}
source_rect.Y += hgt;
}
Literal1.Visible = true;
int abc = (num_rows * num_cols);
Literal1.Text = abc.ToString();
}
}