1. View QQ non-online icons, which are in three colors: white, gray, and black.
2. Open the drawing tool and check the gray RGB ...... surprise ...... the original gray RGB parameters are mostly the same.
3. so it is inferred that the pixels of each non-online avatar are the average value of the online avatar r g B. netizen "string" gave a professional formula (R * 0.299 + G * 0.587 + B * 0.114) 4. operation: obtain the number of images, then obtain R, G, B, calculate the average, and then set the average value back to the number of images.
5. The following is Code: Colorref Cr =: getpixel (HDC, I, j );
Int Nr = getrvalue (CR );
Int ng = getgvalue (CR );
Int NB = getbvalue (CR );
// Int nper = (NR + ng + Nb)/3; // these two methods, it is really difficult for the naked eye to travel. Int nper = nR * 0.299 + ng * 0.587 + NB * 0.114
Cr = RGB (nper, nper, nper );
: Setpixel (HDC, I, j, Cr );
6.