woklet Posted May 10, 2005 Posted May 10, 2005 I'm looking for source code in VB.NET on how to concatenate two bitmaps together, top and bottom. I've tried using the BitBlt function but can't quite seem to get it. Thanks in advance, Ben Quote
a_jam_sandwich Posted May 10, 2005 Posted May 10, 2005 Dim Image1 As New Bitmap("c:\test.bmp") Dim Image2 As New Bitmap("c:\test.bmp") Dim Image3 As New Bitmap(600, 1000) Dim g As Graphics = Graphics.FromImage(Image3) g.DrawImage(Image1, New Point(0, 0)) g.DrawImage(Image2, New Point(0, 500)) g.Dispose() g = Nothing PictureBox1.Image = Image3 This will open a bitmap file that just happens to be 300x500 and load it into Image1 & Image2, image3 then Combines the two images into one big 600x1000 and displays it in a picturebox Hope that helps Andy Quote Code today gone tomorrow!
Leaders snarfblam Posted May 10, 2005 Leaders Posted May 10, 2005 Depending on your needs, you might want to turn it into a function. Function JoinImagesVert(Image1 As Bitmap, Image2 As Bitmap) As Bitmap Dim Result As New Bitmap(Math.Max(Image1.Width, Image2.Width), _ Image1.Height + Image2.Height) Dim gResult As Graphics = Graphics.FromImage(Resi;t) gResult.DrawImage(Image1, New Point(0, 0)) gResult.DrawImage(Image2, New Point(0, Image1.Height)) gResult.Dispose() gResult = Nothing Return Result Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.