Image comparison in javascript