def detect_properties(path):
 vision_client = vision.Client()
 with io.open(path, 'rb') as image_file:
  content = image_file.read()
 image = vision_client.image(content=content)
 properties = image.detect_properties()
 print 'Properties:'
 for prop in properties:
  color = prop.colors[0]
  print 'fraction: {}'.format(color.pixel_fraction)
  print 'r: {}'.format(color.color.red)
  print 'g: {}'.format(color.color.green)
  print 'b: {}'.format(color.color.blue)

def detect_properties ( path ) : vision_client = vision . Client ( ) with io . open ( path , 'rb' ) as image_file : content = image_file . read ( ) image = vision_client . image ( content = content ) properties = image . detect_properties ( ) print 'Properties:' for prop in properties : color = prop . colors [ 0 ] print 'fraction: {}' . format ( color . pixel_fraction ) print 'r: {}' . format ( color . color . red ) print 'g: {}' . format ( color . color . green ) print 'b: {}' . format ( color . color . blue )
detects image properties in the file .