Skip to content

Commit 2721789

Browse files
gguussdpebot
authored andcommitted
Fixes a few style issues that came up in document text review. [(#871)](GoogleCloudPlatform/python-docs-samples#871)
* Fixes a few style issues that came up in document text review. * Fixing my breaks
1 parent e78b973 commit 2721789

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

samples/snippets/crop_hints/crop_hints.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,11 @@ def draw_hint(image_file):
5252

5353
im = Image.open(image_file)
5454
draw = ImageDraw.Draw(im)
55-
draw.line([vects[0].x_coordinate, vects[0].y_coordinate,
56-
vects[1].x_coordinate, vects[1].y_coordinate],
57-
fill='red', width=3)
58-
draw.line([vects[1].x_coordinate, vects[1].y_coordinate,
59-
vects[2].x_coordinate, vects[2].y_coordinate],
60-
fill='red', width=3)
61-
draw.line([vects[2].x_coordinate, vects[2].y_coordinate,
62-
vects[3].x_coordinate, vects[3].y_coordinate],
63-
fill='red', width=3)
64-
draw.line([vects[3].x_coordinate, vects[3].y_coordinate,
65-
vects[0].x_coordinate, vects[0].y_coordinate],
66-
fill='red', width=3)
55+
draw.polygon([
56+
vects[0].x_coordinate, vects[0].y_coordinate,
57+
vects[1].x_coordinate, vects[1].y_coordinate,
58+
vects[2].x_coordinate, vects[2].y_coordinate,
59+
vects[3].x_coordinate, vects[3].y_coordinate], None, 'red')
6760
im.save('output-hint.jpg', 'JPEG')
6861
# [END draw_hint]
6962

@@ -74,8 +67,8 @@ def crop_to_hint(image_file):
7467
vects = get_crop_hint(image_file)
7568

7669
im = Image.open(image_file)
77-
im2 = im.crop((vects[0].x_coordinate, vects[0].y_coordinate,
78-
vects[2].x_coordinate - 1, vects[2].y_coordinate - 1))
70+
im2 = im.crop([vects[0].x_coordinate, vects[0].y_coordinate,
71+
vects[2].x_coordinate - 1, vects[2].y_coordinate - 1])
7972
im2.save('output-crop.jpg', 'JPEG')
8073
# [END crop_to_hint]
8174

0 commit comments

Comments
 (0)