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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.