Results 1 to 7 of 7

Thread: Range Color Remover

  1. #1

    Thread Starter
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229

    Question Range Color Remover

    I have a getright skin making aplication and there is one major flaw in it. When the skins are compilled in 24Bit there are disgressions in the color, probally left from the paint program. How could i go from 1 sample color and remove all colors like it? I allready have a fast system for changing the color i really need is a was to check a color from a long for all the diffrent shades.

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Well I believe what you want is somethat that will remove similar colors??

    Define a threshold, say 15. Then loop through all pixels, if Red component of color is within "threshold" of the color you want to get rid of, and so are Green and Blue, then change.

    Ex:
    Color to change RGB = 100, 100, 200

    Threshold = 10

    Color found RGB = 110, 95, 206

    All values are within "threshold" of the color to change, so change it


    OR

    Color found RGB = 100, 100, 0

    Values aren't all within "threshold" of the color to change, leave it alone


    Did that make sense?
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3

    Thread Starter
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229
    I know that, but how could i use the colors from getPixelV that returns a long.

  4. #4
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Ah...ok what you have to do split the long into several bytes. I don't exactly remember how this works, but MSDN should be able to help. There may also be an API that does this for you, so check around carefully.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  5. #5

    Thread Starter
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229
    I found a hard way to find the RGB value of a pixel by brute force. I couldn't find a simpler way.

  6. #6
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200
    Here are two ways of getting the RGB values from LONG.

    Most-used way:
    Code:
    Private Sub Form_Load()
    Dim lColor As Long
    Dim iRed As Integer, iGreen As Integer, iBlue As Integer
    
    lColor = RGB(255, 128, 64) 
    
    'Get the R G B values
    iRed = lColor Mod 256
    iGreen = (lColor \ 256) Mod 256
    iBlue = ((lColor \ 256) \ 256) Mod 256
    
    MsgBox "R, G, B values: " & iRed & ", " & iGreen & ", " & iBlue
    End Sub
    Using the CopyMemory API:
    Code:
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
    
    Private Sub Form_Load()
    Dim lColor As Long, c(3) As Byte
    
    lColor = RGB(255, 128, 64) 
    CopyMemory c(0), lColor, 4
    
    MsgBox "R, G, B values: " & c(0) & ", " & c(1) & ", " & c(2)
    End Sub
    Hope this helps.

  7. #7

    Thread Starter
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229
    yeah now i can do searches with a hugh tollerance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width