Created
September 23, 2016 17:44
-
-
Save nbortolotti/3215f5d1b1f0ba9c3f2abfe98f1df8cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#open a img-file | |
with open(photo_file, 'rb') as image: | |
image_content = base64.b64encode(image.read()) | |
service_request = service.images().annotate( | |
body={ | |
'requests': [{ | |
'image': { | |
'content': image_content | |
}, | |
'features': [{ | |
'type': 'IMAGE_PROPERTIES', #type of detection | |
'maxResults': 1, | |
}] | |
}] | |
}) | |
response = service_request.execute() #service request | |
color = response['responses'][0]['imagePropertiesAnnotation']['dominantColors']['colors'][0] #information of the response | |
print('Color: %s para %s' % (color, photo_file)) #print the info | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment