MonkeyRunner does indeed offer pretty decent image based test methods. I will show you below how to take a sub-image from the currently displayed screen of your device. Then you can save this sub-image and/or compare with a reference image
First you need to take a screenshot of the current screen of your device
# Take a screenshot
image = device.takeSnapshot()
Then you can take a sub-image. For example, this sub-image could be a button on a certain screen to verify that the button exists on that screen. To be able to do that you can use the method below. The tuple (0, 0, 50, 100) below is only an example. You should provide your own. Basically it is (x, y, w, h) of the desired sub-image.
# Take the sub-image
sub_image = image.getSubImage((0, 0, 50, 100))
After that step, you can save the image and/or compare with a reference image. To compare with a reference image you can do as shown below:
# Load the reference image for comparison
reference = MonkeyImage.loadFromFile(PATH_TO_REFERENCE_IMAGE)
if not sub_image.sameAs(reference, 0.9):
print "Images do not match!"
# do something
0.9 is the acceptance level. If the two images match 90% or above, it will be considered as PASSED
Hope this helps. Do let me know if you encounter any problems!