| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ba737c3 commit f9c32f1
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,18 +52,11 @@ def draw_hint(image_file): | |||
| 52 | 52 | ||
| 53 | 53 | im = Image.open(image_file) | |
| 54 | 54 | 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') | ||
| 67 | 60 | im.save('output-hint.jpg', 'JPEG') | |
| 68 | 61 | # [END draw_hint] | |
| 69 | 62 | ||
@@ -74,8 +67,8 @@ def crop_to_hint(image_file): | |||
| 74 | 67 | vects = get_crop_hint(image_file) | |
| 75 | 68 | ||
| 76 | 69 | 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]) | ||
| 79 | 72 | im2.save('output-crop.jpg', 'JPEG') | |
| 80 | 73 | # [END crop_to_hint] | |
| 81 | 74 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments