Take part of an image to assign to another variable

tahu191

Well-known member
Joined
Oct 27, 2005
Messages
48
Location
USA
Programming Experience
Beginner
I have a large image that I could like to cut out smaller parts from and store them in an array. I guess it's kind of like sprite imaging for games. How would I do this?
 
Draw the part to a new image.
VB.NET:
Dim bigimage As Image = ...
Dim partimage As New Bitmap(100, 100)
Using g As Graphics = Graphics.FromImage(partimage)
    Dim dest As New Rectangle(0, 0, 100, 100)
    Dim src As New Rectangle(150, 150, 100, 100)
    g.DrawImage(bigimage, dest, src, GraphicsUnit.Pixel)
End Using
 
Back
Top