It is a code that copies 200x200 images from the x and y positions of the originalBmp and copies them to the rectbmp
There is no problem with the image and the x and y values
but rectbmp is always black
Bitmap originalBmp = new Bitmap("C:\\Users\\park\\Downloads\\imsi\\textImage.bmp");
int x = (int)P.X;
int y = (int)P.Y;
int rectWidth = 200;
int rectHeight = 200;
Bitmap rectBmp = new Bitmap(rectWidth, rectHeight);
Graphics g = Graphics.FromImage(rectBmp);
g.DrawImage(originalBmp,new Rectangle(x-100, y-100, rectWidth, rectHeight));
pictureBox1.Image = originalBmp;
rectBmp.Save("C:\\Users\\park\\Downloads\\imsi\\result.bmp", ImageFormat.Bmp);