如何获取图像的一部分并将其用作单独的图像?

我有一个tileset,但所有的tile都在一个图像中。 我希望得到某种位图或图像数组中的每个图块。 是否有某种方法可以做到这一点?

使用Bitmap.Clone(Rectangle,PixelFormat) ,这里我们可以设置新图像的PixelFormat和矩形的大小

// Create a Bitmap object from a file. Bitmap myBitmap = new Bitmap("Grapes.jpg"); // Clone a portion of the Bitmap object. Rectangle cloneRect = new Rectangle(0, 0, 100, 100); System.Drawing.Imaging.PixelFormat format = myBitmap.PixelFormat; Bitmap cloneBitmap = myBitmap.Clone(cloneRect, format); // Draw the cloned portion of the Bitmap object. e.Graphics.DrawImage(cloneBitmap, 0, 0);