C#. Crop image on N rectangles
I need to crop image on N rec开发者_JAVA百科tangles.
Condition for all rectangles:
Rectangle's width = X Rectangle's height = X/2Any algorithm ?
This can help you:
private static Image cropImage(Image img, Rectangle cropArea)
{
Bitmap bmpImage = new Bitmap(img);
Bitmap bmpCrop = bmpImage.Clone(cropArea,
bmpImage.PixelFormat);
return (Image)(bmpCrop);
}
I found a more complex but complete example here:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/e0c30a26-60da-457d-a217-ba95650deec8
精彩评论