diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2020-08-25 18:06:19 +0100 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2020-08-25 18:06:19 +0100 |
commit | 98bc58c5d93c16a8cd71b9622dde9a88f84b7d8b (patch) | |
tree | 0f6200d4e52c2463382f54ff512126dd0aa87fc1 /utils.py | |
parent | 05b7e83f7cc2dba0991a81c647d384abbda63fd2 (diff) | |
download | yaoi-communism-98bc58c5d93c16a8cd71b9622dde9a88f84b7d8b.tar.gz yaoi-communism-98bc58c5d93c16a8cd71b9622dde9a88f84b7d8b.zip |
added tweeting, pretty much done
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -7,6 +7,7 @@ import random import subprocess
import json
from colorthief import ColorThief
+import get_images
def draw_with_border(x, y, message, color_fill, color_border, font, draw):
@@ -95,7 +96,7 @@ def get_colors(file_name): return color_thief.get_palette(color_count=2, quality=1)
-def randomize_location(image, messages, font):
+def randomize_location(image, messages, font, faces):
image_size = image.size
x_coordinate = 0
y_coordinate = 0
@@ -110,8 +111,6 @@ def randomize_location(image, messages, font): # randomize locations that still fit
placed = False
tries = 0
- faces = detect(image.filename)
- print("faces found:", len(faces))
while placed is False and tries < 20:
placed = True
x = random.randrange(0, image_size[0] - x_coordinate)
@@ -120,7 +119,7 @@ def randomize_location(image, messages, font): if is_intersected(face, (x, y, x + x_coordinate, y + y_coordinate)):
placed = False
tries = tries + 1
- print("tried:", tries)
+ get_images.logging.info("tried: %i" % tries)
return (x, y, len(faces))
|