How to crop an image using C#?

后端 未结 14 846
忘掉有多难
忘掉有多难 2020-11-22 05:16

How can I write an application that will crop images in C#?

14条回答
  •  长情又很酷
    2020-11-22 05:56

    Check out this link: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing

    private static Image cropImage(Image img, Rectangle cropArea)
    {
       Bitmap bmpImage = new Bitmap(img);
       return bmpImage.Clone(cropArea, bmpImage.PixelFormat);
    }
    

提交回复
热议问题