Results 1 to 4 of 4

Thread: How to get all RGB values from image file

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    How to get all RGB values from image file

    Hi,

    I'm a beginner in VB and i need to complete one task to list out all the RGB values from the .BMP image file. I have no idea how to do this coz i'm not familiar in Vb before.

    Hopefully someone can help me.

    Regards
    munniax

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: How to get all RGB values from image file

    Merry Christmas.

    VB Code:
    1. Private Sub Form_Activate()
    2.    
    3.     With Picture1
    4.    
    5.         .AutoRedraw = True
    6.         .ScaleMode = vbPixels
    7.         .AutoSize = True
    8.         .BorderStyle = 0
    9.    
    10.     End With
    11.    
    12.     Picture1.Picture = LoadPicture("C:\Temp\Sprite1.bmp")
    13.  
    14.     Dim X As Long, Y As Long
    15.     Dim RGB_Array() As Long
    16.    
    17.     ReDim RGB_Array(Picture1.ScaleWidth - 1, Picture1.ScaleHeight - 1) As Long
    18.    
    19.     For Y = 0 To Picture1.ScaleHeight - 1
    20.         For X = 0 To Picture1.ScaleWidth - 1
    21.             RGB_Array(X, Y) = Picture1.Point(X, Y)
    22.         Next X
    23.     Next Y
    24.  
    25. End Sub

  3. #3
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: How to get all RGB values from image file

    You could also use the GetDIBits() API function which I believe is a bit faster. There's some info on it at: www.allapi.net

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    Re: How to get all RGB values from image file

    thanks

    i will try first..

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