Results 1 to 3 of 3

Thread: how to convert long colour values to rbg values?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    22

    how to convert long colour values to rbg values?

    i upload a image, i click on the image and it tells me 0 for black, and 6817807 for dark blue. how do i convert these numbers into rgb values?

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: how to convert long colour values to rbg values?

    There are many posts/threads on VBF about this.
    This is a way to do it:
    Code:
        Dim ColorCode As Long
        Dim sHex As String
        Dim R As Byte, G As Byte, B As Byte
        
        ColorCode = 6817807
        
        R = ColorCode And &HFF&
        G = (ColorCode And &HFF00&) \ &H100&
        B = (ColorCode And &HFF0000) \ &H10000
    
        Debug.Print ColorCode, R, G, B, RGB(R, G, B)
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    22

    Re: how to convert long colour values to rbg values?

    thx dude

    well now that i have done that and i know the rgb , long value, and the colour pixel. how do i create a loop so that my program automatically reads the pixels in a row and tell me in a msgbox how many pixels are there in the row and the colours(etc white black red blue green magenta cyan) in detail?

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