The latest project requires irregular cropping. I originally wanted to use the html5 canvas to implement it at the front end, but it was a bit difficult to find out. The following section describes how to process the image on the C # side. Now, you can paste the following code as a button event to prepare the image, crop the path, and save the private void button#click (object sender, EventArgs e) for cropping) {GraphicsPath path = new GraphicsPath (); Point [] p = {new Point (424,244), new Point (240,440), new Point (340,552), new Point (550,526 ), new Point (478,366), new Point (348,660), new Point (424,244)}; path. addLines (p); OpenFileDialog openFileDialog = new OpenFileDialog (); openFileDialog. filter = @ "Bitmap file (*. Bmp) | *. bmp | Jpeg file (*. jpg) | *. jpg | all suitable files (*. bmp ,*. jpg) | *. bmp ;*. jpg "; openFileDialog. filterIndex = 3; openFileDialog. restoreDirectory = true; if (DialogResult. OK = openFileDialog. showDialog () {Bitmap bit = (Bitmap) Bitmap. fromFile (openFileDialog. fileName, false); Bitmap newBit = null; BitmapCrop (bit, path, out newBit); newBit. save (@ "C: \ Users \ Public \ Pictures \ Sample Pictures \ desert 22.jpg") ;}} The following are the key to cropping. Code /// <summary> /// image /// </summary> /// <param name = "bitmap"> source image </param> /// <param name = "path"> cropping path </param> /// <param name = "outputBitmap"> output graph </param> /// <returns> </returns> public static bitmap BitmapCrop (Bitmap bitmap, graphicsPath path, out Bitmap outputBitmap) {RectangleF rect = path. getBounds (); int left = (int) rect. left; int top = (int) rect. top; int width = (int) rect. width; int height = (Int) rect. height; Bitmap image = (Bitmap) bitmap. clone (); outputBitmap = new Bitmap (width, height); for (int I = left; I <left + width; I ++) {for (int j = top; j <top + height; j ++) {// determine whether the coordinates are in the path if (path. isVisible (I, j) {// copy the pixels in the source image area to the outputBitmap of the output image. setPixel (I-left, j-top, image. getPixel (I, j); // set the original image to a transparent image. setPixel (I, j, Color. fromArgb (0, image. getPixel (I, j);} else {outp UtBitmap. setPixel (I-left, j-top, Color. fromArgb (0,255,255,255) ;}} bitmap. dispose (); return image;} with this foreground, you only need to obtain the user's mouse path and upload it to the background.