Results 1 to 2 of 2

Thread: long integer from point(x,y)

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 1999
    Location
    Borne, Overijssel, Netherlands
    Posts
    1

    Post

    When I read the color from an image with the point command it returns a long integer.
    How can I get the RGB's from that?

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Here's one method:
    Code:
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim sColor As String
        Dim iRed As Integer
        Dim iGreen As Integer
        Dim iBlue As Integer
        
        sColor = Hex$(Picture1.Point(X, Y))
        iBlue = Val("&H" & Left$(sColor, 2))
        iGreen = Val("&H" & Mid$(sColor, 3, 2))
        iRed = Val("&H" & Right$(sColor, 2))
        Caption = "R: " & Right$("000" & iRed, 3) & _
        " G: " & Right$("000" & iGreen, 3) & _
        " B: " & Right$("000" & iBlue, 3)
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

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