Posted 17 January 2009 - 05:29 PM

Function AverageRGB(ByRef P As PictureBox) As Long Dim Count As Long Dim Red As Long Dim Green As Long Dim Blue As Long Dim Hexed As String Dim X As Long Dim Y As Long Count = 0 For X = 0 To P.Width Step P.Width \ 32 For Y = 0 To P.Height Step P.Height \ 32 Hexed = Right("00000" & Hex(P.Point(X, Y)), 6) Red = Red + CLng("&h" & Right(Hexed, 2)) Green = Green + CLng("&h" & Mid(Hexed, 3, 2)) Blue = Blue + CLng("&h" & Left(Hexed, 2)) Count = Count + 1 Next Next AverageRGB = RGB(Red \ Count, Green \ Count, Blue \ Count) End Function

ok yall, dont go fawning over this to damn much. i had code in vb that analysed the picture and chose the dominant color some three years ago.hell, i even had it in a wallpaper changer that would set your desktop background color to the dominant color for a seemless look.give me a day or so and i will post the code for it in VB here.it is NOT nothing new.[edit] found the code some minute after i posted my response, here is the vb6 code.[/edit]see? easy math through the use of RGB. Please note that this code is some three YEARS old and stop fawning over MS's shit.actually i take it back, the code was made in 2002.