Skip to content

Commit

Permalink
Use default font [(#1865)](GoogleCloudPlatform/python-docs-samples#1865)
Browse files Browse the repository at this point in the history
Test environment does not support all fonts.
  • Loading branch information
engelke committed Nov 27, 2018
1 parent ee1897b commit 29c973b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions samples/snippets/face_detection/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down Expand Up @@ -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]
Expand All @@ -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]

Expand Down

0 comments on commit 29c973b

Please sign in to comment.