I have 2 bitmaps. They are almost equals. I need get  the differences between them in a new bitmap, but just the differences. How can I do this?

Who is Participating?
nietodConnect With a Mentor Commented:
Use GetDIBits() to get the bits from the two bitmaps. Then compare cooresponding pixels of the two bitmaps.  There are a variety of ways to compare two pixels.  You might want to see if the two are identical or you might want to see if they are close, you can use

sqrt( (R1-R2)^2 + (G1+G2)^2 + (B1+B2)^2 )

to get an idea of how close two values are.  (R1 is the red value of a pixle from bitmap 1, R2 is the vlaue from bitmap 2, G is for green and B is for blue.)  This value wil be 0 for identical pixels and will get larger as they get more different.
fantasma110899Author Commented:
Do I must compare each bit in the two bitmaps? There is not an "AND" or "OR" between two bitmaps?  
You can use BitBlt() to do that sort of thing, but it probably is not what you want.  First of all it will be useful only if you want to find exact matches, and after it is done you will need to scan the results to find out which pixels have changed.
All Courses

From novice to tech pro — start learning today.