Sub SplitImage(ByVal path As String, ByVal nbImageX As Integer, ByVal nbImageY As Integer)
Dim original As New Bitmap(path)
Dim focusRectangle As New Rectangle()
Dim destination As Drawing.Bitmap
For x As Integer = 0 To nbImageX - 1
For y As Integer = 0 To nbImageY - 1
focusRectangle.X = x * (original.Width / nbImageX)
focusRectangle.Y = y * (original.Height / nbImageY)
focusRectangle.Height = original.Height / nbImageX
focusRectangle.Width = original.Width / nbImageY
destination = original.Clone(focusRectangle, PixelFormat.DontCare) 'on définit un second BitMap Clonant une partie du 1ere BitMap avec le rectangle
destination.Save("im" + x.ToString() + y.ToString() + ".jpg")
Next
Next
End Sub