I would like to compare two images with javascript. One is drawn on a html5 canvas the other might be on another html5 canvas, or it might be a gif- or png-image-file. I need the comparision for automated testing. Thanks for help!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
alright this isn’t a complete solution for your problem but it might help you find a good way to compare the two canvas elements.
This is a basic example how to loop through all the pixels on the canvas. Depending on what you want to do you can compare the pixels with each other or you might want to compare the two
imageDatavars with each other