| brandonbrown
   
 
                USA37 Posts
 | 
                    
                      |  Posted - Dec 20 2021 :  19:57:00     
 |  
                      | Thank you to Nigel (as usual) for coming up with something simple! 
 I added layers to my project and noticed it had the ability to Substitute one color with another, but I am not getting it work. I have attached a sample of the red color I want to remove from a form. Some scanners do the red drop out, however I was going to try to do this in software.
 
 In this case, attached, I want to change the red on the form to white. There are no other colors on the form, just red.
 
 I added the image as a layer. It displayed way down in the ieviewer1.image window, but that's another question.
 
 I tried different versions of the code below, but it just doesn't pick the red correctly. I tried a single color also, using paint and getting the eye dropper to give me the RGB numbers.
 
 Am I missing something?
 
 Dim newLayer As Integer = IeViewer1.Image.LayersAdd("c:\batches\20211220-0001.tif", -1000, -1000)
 
 Dim oldColor1 As HiComponents.IEvolution.IERGB
 Dim oldColor2 As HiComponents.IEvolution.IERGB
 Dim newColor As HiComponents.IEvolution.IERGB
 
 oldColor1.r = 255
 oldColor1.g = 0
 oldColor1.b = 0
 
 oldColor2.r = 160
 oldColor2.g = 255
 oldColor2.b = 255
 
 newColor.r = 255
 newColor.g = 255
 newColor.b = 255
 
 IeViewer1.Image.SelectColors(oldColor1, oldColor2, HiComponents.IEvolution.IEImage.SelOp.Add)
 IeViewer1.Image.SetSelectedPixelsColor(newColor)
 
 
  |  |