0

Hi i am trying compare images with help of AndroidViewClient 5.1.1 following is the code which i have written, but always it is printing Both images are not same. Is this the correct way of using sameAs function? if not could you please let me know the correct way of using it.

from PIL import Image

image1=('Smell.jpg')
image2=('Smell1.jpg')

if sameAs(image1, image2, percent=1.0):
print "Both Images are same"
else:
print"Both images are not same"

While using monkeyRunner we use to load image.. do we have to load in new version as well.

Solenya
  • 694
  • 6
  • 21
user3548662
  • 29
  • 1
  • 7

1 Answers1

0

You need to know that the comparison of images is made pixel by pixel.

That is to say, it compares the pixel 1 of the image1 with the pixel 1 of the image2, the 2 of the image1 with the 2 of the Picture2, and so on.

Therefore, you have to be sure that you compare images that are equal or not, to test your code.

EDIT: Android Reference Developer

Víctor Martín
  • 3,352
  • 7
  • 48
  • 94