1 #!/usr/bin/env python 2 3 import argparse 4 import sys 5 6 argparser = argparse.ArgumentParser( 7 description="Take a screenshot!", 8 epilog="I can output PNG, JPEG, GIF, and other PIL-supported formats.") 9 argparser.add_argument("-c", "--crtc", type=int, default=0, 10 help="CRTC id (default first screen)") 11 argparser.add_argument("path", help="output image location") 12 13 args = argparser.parse_args() 14 15 # Do some evil. 16 sys.path.insert(0, "/usr/local/autotest") 17 18 # This import can't be moved to before the sys.path alteration. 19 from cros.graphics.gbm import crtcScreenshot 20 image = crtcScreenshot(args.crtc) 21 image.save(args.path) 22