I'm trying to crop an image in windows forms (C#). I did it with straight corners. But I want to split it with curve lines.
A Single image is split into a 3x3 image and then placed in 9 different pictureBoxes. Here is my current code:
Image img = pictureBox1.Image;
int widththird = (int)((double)img.Width / 3.0 + 0.5);
int heightthird = (int)((double)img.Height / 3.0 + 0.5);
Bitmap[,] bmps = new Bitmap[3, 3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
bmps[i, j] = new Bitmap(widththird, heightthird);
Graphics g = Graphics.FromImage(bmps[i,j]);
g.DrawImage(img, new Rectangle(0, 0, widththird, heightthird), new
Rectangle(j * widththird, i * heightthird, widththird, heightthird),
GraphicsUnit.Pixel);
g.Dispose();
}
}
pictureBox2.Image = bmps[0, 0];
pictureBox3.Image = bmps[0, 1];
pictureBox4.Image = bmps[0, 2];
pictureBox5.Image = bmps[1, 0];
pictureBox6.Image = bmps[1, 1];
pictureBox7.Image = bmps[1, 2];
pictureBox8.Image = bmps[2, 0];
pictureBox9.Image = bmps[2, 1];
pictureBox10.Image = bmps[2, 2];
Q: How can I can crop/split the image with curves and export the pieces?
My output:
I want it cropped like this: