This is a duplicate thread of the one that lots of people answered this question in.
http://www.vbforums.com/showthread.php?t=385477
However, I'll make one final stab at it, modifying my code above.
VB Code:
Dim gr As Graphics 'Make a new graphics object Dim Bm As Image = Image.FromFile("firstimage.png") Dim Bm2 As Image = Image.FromFile("secondimage.png") Dim mergedbitmap As New Bitmap(Bm.Width + Bm2.Width, Bm.Height) 'Create a memory bitmap object the size of your two images gr = Graphics.FromImage(mergedbitmap) 'Assing the graphics object to the memory bitmap gr.DrawImage(Bm, 0, 0) 'Draw the first image to the memory bitmap object. gr.DrawImage(Bm2, Bm.Width, 0) 'Draw the second image to the memory bitmap object. PictureBox1.Image = mergedbitmap 'Set the picture to the memory bitmap PictureBox1.Image.Save("Z:\merged.ping", Imaging.ImageFormat.Png) 'Save it as a png file gr.Dispose() 'Always dispose graphics objects.
In the future, it's considered rude to start a thread about something when lots of people have given you advice already about it.
Bill




Reply With Quote