save a portion of an image in stream

Blue1979

New member
Joined
Aug 9, 2005
Messages
1
Programming Experience
1-3
I want to make an image puzzel, so I need to divide a image to some rectangles and save each of them seperately to be shown as buttons' images in the next steps. But I have problem with dividing an image into these portions ! I couldn't find any method which save an image portion from point(i,j) to point(x,y) to another image !!! I found out thet I should have done that through streams, but It seems more confusing : Hoe can I load that portion of image into an stream ???

Please help me, I've got really confused.

Blue1979

_______________________________________
whenever ther is a will , there is a way
_______________________________________
 
example

I got an example here extracting to a new bitmap a 100by100 pixels square from location x100y100 in source image, displaying it in a picturebox:
VB.NET:
Dim img As Image = Image.FromFile("f:\pictures\1126972183.jpg")
Dim bmp As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(bmp)
Dim destRct As RectangleF = bmp.GetBounds(GraphicsUnit.Pixel)
Dim srcRct As New RectangleF(100, 100, 100, 100)
g.DrawImage(img, destRct, srcRct, GraphicsUnit.Pixel)
g.Dispose()
PictureBox1.Image = bmp
 
Back
Top