sorry i posted in the classic forum to begin with ...

im running the following code below to replace colours .... the code works fine but i need a way to break down RGB values to calculate if the colour is roughly in the same range as the image .... how can i do this

any help would be great
many thanks
illskills


VB Code:
  1. Dim mycc As New ColorConverter
  2.         pgbProgress.Maximum = 256
  3.         For iColour As Integer = 0 To 255
  4.  
  5.             pgbProgress.Value = iColour
  6.             pgbProgress.Refresh()
  7.             If Not IsNothing(arrColoursToReplace(iColour)) Then
  8.                 For i As Integer = 1 To 1000 '# loops throught mosaics
  9.                     If IsNothing(arrCustomMosaics(i, 0, 0)) Then Exit For
  10.                     For x As Integer = 1 To 15
  11.                         For y As Integer = 1 To 15
  12.                             If Not IsNothing(arrCustomMosaics(i, x, y)) Then
  13.                                 If mycc.ConvertToString(arrCustomMosaics(i, x, y).ToString) = mycc.ConvertToString(arrColoursToReplace(iColour).ToString) Then
  14.                                     arrColoursToReplace(iColour) = arrCustomMosaics(i, 0, 0)
  15.                                 End If
  16.                             End If
  17.                         Next
  18.                     Next
  19.                 Next
  20.             End If
  21.         Next
  22.         For i As Integer = 1 To 255
  23.             If Not IsNothing(arrColoursToReplace(i)) Then
  24.                 txtmytextbox.Text = txtmytextbox.Text & vbCrLf & arrColoursToReplace(i).tostring
  25.             End If
  26.         Next