Qq Avatar gray algorithm [Figure]

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.