If you are going to compare them in such a way that they have to be exactly the same ... which this does ... why not just compare the actual files (or a hash of the actual files)?
That is a better idea if it is possible - but in cases where it isn't (like if the pictures are drawn rather than loaded from a file, or if a picture was loaded via properties), this is a good method.
An obscure body in the SK system. The inhabitants call it Earth
Posts
7,957
Re: [VB6] - Compare images the fast way
Hi Lukie Luke and welcome to the forums
Please don't piggyback your questions onto old threads like this. 1. It clutters up the forums and 2. It means you're less likely to recieve an answer. Instead, start your own thread and ask your question as clearly as possible. If you want to reference this thread then just include a hyperlink to it.
Regards FD
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
Bonsoir, je sais que c'est un vieux post mais suite à une grave maladie j'ai du mettre la programmation de côté...
voilà, mon soucis avec ton exemple est que si je fais une capture d'écran et que charge une image sauvée bien cela ne marche pas pourtant le 2 images sont identiques.
merci et bonne soirée
Good evening, I know this is an old post but following a serious illness I had to put programming aside...
There you go, my problem with your example is that if I take a screenshot and load a saved image it doesn't work however the 2 images are identical.
thank you and good evening
This forum is in English. While your question is very much relevant to this thread, since it is about the code in the thread, I was tempted to move it to the Classic VB section as a new thread. I didn't, because it's probably better if you asked the thread...and who knows, maybe somebody will revive this? It's the CodeBank, after all, which is about posting working examples, and asking about those examples, so the post is correct. Unfortunately, it's also 17 years too late. It's very likely that the OP has moved on and will never see the question.
Starting a new thread that references this one is probably the best thing to do. Start it in English, though, even if you go through Google Translate. You spoke so clearly that even with my very poor, and rusty, French, I understood most of what you wrote, so Google will do a good job.
The attached program compares pixel by pixel; with two screenshots it's very unlikely that some pixel somewhere on the screen hasn't changed from one screen shot to another. There's *zero* tolerance in this program; if even a single pixel out of the 2,073,600 (for 1920x1080) to 8,294,400 (for 4k 3840x2160) or even more on some screens has changed, it will no longer be identical according to the code posted. Even saved vs unsaved; the algorithm to save it will change some pixels unless you use a lossless format that supports exactly the format its originally captured (or pasted) in.
Je parle Francais mais pour les autres ici, on devrait utilisier l'Anglais
Last edited by fafalone; Jun 9th, 2024 at 01:33 AM.