Jump to content

Colour Reference Replace


Nim199
 Share

Recommended Posts

Hi all,I am really getting into VB.NET now, but have hit a brick wall.How can I take an image (bmp) and replace any colour with a texture?I have found one way, where you make the colour transparent, then make a new image where you paste the texture opn first, then layer over the transparented original image.

Public Class Form1    Dim g As Graphics    Dim img, img2 As Bitmap    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        img = New Bitmap(200, 200)        g = Graphics.FromImage(img)        g.DrawImage(PictureBox1.Image, 0, 0)        img.MakeTransparent(Color.Black) ' Remove Black        img2 = New Bitmap(200, 200) ' New Imgage        g = Graphics.FromImage(img2)        g.DrawImage(PictureBox2.Image, 0, 0) ' Add texture        g.DrawImage(img, 0, 0) ' Add Overlay        PictureBox3.Image = img2    End SubEnd Class

I am sure there must be another way, and help would be great.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...