djcybex
asked on
Merge two pictures in VB.NET
I have three pictureboxes. How to combine two pictures from two pictureboxes to third one...so that first picture is behind the second?
I need to save the third (combined) picture in database... (i know how to do this)
Thank you in advance.
Matej
I need to save the third (combined) picture in database... (i know how to do this)
Thank you in advance.
Matej
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try either to resize image
Private Sub ResizeImage()
Dim filename As String = "C:\windows\web\wallpaper\ wind.jpg"
Dim photo As System.Drawing.Bitmap = New System.Drawing.Bitmap(file name)
'Resize to medium
Dim w As Integer = 200
Dim h As Integer = 200
Dim medium As New System.Drawing.Bitmap(w, h)
Dim mG As System.Drawing.Graphics = System.Drawing.Graphics.Fr omImage(me dium)
mG.CompositingQuality = System.Drawing.Drawing2D.C ompositing Quality.Hi ghSpeed
mG.InterpolationMode = System.Drawing.Drawing2D.I nterpolati onMode.Bic ubic
mG.DrawImage(photo, 0, 0, w, h)
'Save
medium.Save(filename, System.Drawing.Imaging.Ima geFormat.J peg)
medium.Dispose()
photo.Dispose()
End Sub
or stretch it to the picbox size
picImage.SizeMode = PictureBoxSizeMode.Stretch Image
Private Sub ResizeImage()
Dim filename As String = "C:\windows\web\wallpaper\
Dim photo As System.Drawing.Bitmap = New System.Drawing.Bitmap(file
'Resize to medium
Dim w As Integer = 200
Dim h As Integer = 200
Dim medium As New System.Drawing.Bitmap(w, h)
Dim mG As System.Drawing.Graphics = System.Drawing.Graphics.Fr
mG.CompositingQuality = System.Drawing.Drawing2D.C
mG.InterpolationMode = System.Drawing.Drawing2D.I
mG.DrawImage(photo, 0, 0, w, h)
'Save
medium.Save(filename, System.Drawing.Imaging.Ima
medium.Dispose()
photo.Dispose()
End Sub
or stretch it to the picbox size
picImage.SizeMode = PictureBoxSizeMode.Stretch
ASKER
can you please suggest how to center the front picture to the one in the back?
i know you can set cordinates in
g.DrawImage(MergedBMP,x,y)
but pictures are diferent sizes...
and also DrawImage makes picture smaller than original..why is that?