From 29c973b013f5eac3c278f5b067082b1a4a713064 Mon Sep 17 00:00:00 2001 From: Charles Engelke Date: Tue, 27 Nov 2018 13:03:24 -0800 Subject: [PATCH] Use default font [(#1865)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1865) Test environment does not support all fonts. --- samples/snippets/face_detection/faces.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/snippets/face_detection/faces.py b/samples/snippets/face_detection/faces.py index 085c2c17..a262f3e1 100755 --- a/samples/snippets/face_detection/faces.py +++ b/samples/snippets/face_detection/faces.py @@ -21,7 +21,7 @@ # [START vision_face_detection_tutorial_imports] from google.cloud import vision from google.cloud.vision import types -from PIL import Image, ImageDraw, ImageFont +from PIL import Image, ImageDraw # [END vision_face_detection_tutorial_imports] @@ -60,7 +60,6 @@ def highlight_faces(image, faces, output_filename): im = Image.open(image) draw = ImageDraw.Draw(im) # Sepecify the font-family and the font-size - font = ImageFont.truetype("arial.ttf", 25) for face in faces: box = [(vertex.x, vertex.y) for vertex in face.bounding_poly.vertices] @@ -70,7 +69,7 @@ def highlight_faces(image, faces, output_filename): draw.text(((face.bounding_poly.vertices)[0].x, (face.bounding_poly.vertices)[0].y - 30), str(format(face.detection_confidence, '.3f')) + '%', - font=font, fill='#FF0000') + fill='#FF0000') im.save(output_filename) # [END vision_face_detection_tutorial_process_response]