hi there hope all is well.im trying to transfer the alpha channel from one image to another and am having trouble.if anyone could steer me the right way i would be very thankful.i have this to show where im at with my code.
VB.NET:
Dim bm As New Bitmap(PictureBox1.Image)
Dim g As Graphics = Graphics.FromImage(PictureBox1.Image)
Dim bm1 As New Bitmap(PictureBox2.Image)
Dim gr As Graphics = Graphics.FromImage(PictureBox2.Image)
Dim x As Integer
Dim y As Integer
Dim PixelSize As Integer = 4
Dim bmd As BitmapData = bm.LockBits(New Rectangle(0, 0, 300, 80), System.Drawing.Imaging.ImageLockMode.ReadOnly, bm.PixelFormat)
Dim bmd1 As BitmapData = bm1.LockBits(New Rectangle(0, 0, 300, 80), System.Drawing.Imaging.ImageLockMode.WriteOnly, bm1.PixelFormat)
For y = 0 To bmd1.Height - 1
For x = 0 To bmd.Width - 1
Marshal.ReadByte(bmd.Scan0, (bmd.Stride * y) + (4 * x + 3))
Marshal.WriteByte(bmd1.Scan0, (bmd1.Stride * y) + (4 * x + 3), 255)
Next
Next
bm.UnlockBits(bmd)
bm1.UnlockBits(bmd1)
PictureBox3.Image = bm1
PictureBox3.Image.Save("c:/1.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
Last edited by a moderator: