Skip to content

Updates for new Pillow + Update Deps #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/pull_request_template.md

This file was deleted.

176 changes: 0 additions & 176 deletions .github/workflows/ci.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/docs.yml

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def read_long_description():
"blend-modes",
"fonttools",
"imgaug",
"numpy",
"numpy==1.26",
"opencv-python",
"pillow>=8.2.0",
"pillow>=11.0.0",
"pygame",
"python-bidi",
"pytweening",
Expand Down
6 changes: 4 additions & 2 deletions synthtiger/layers/text_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@ def _get_bbox(self, text, font, vertical):

if not vertical:
ascent, descent = font.getmetrics()
width = font.getsize(text, direction=direction)[0]
left, top, right, bottom = font.getbbox(text, direction=direction)
width = right - left
height = ascent + descent
bbox = [0, -ascent, width, height]
else:
width, height = font.getsize(text, direction=direction)
left, top, right, bottom = font.getbbox(text, direction=direction)
width, height = right - left, bottom-top
bbox = [-width // 2, 0, width, height]

return bbox
Expand Down
7 changes: 6 additions & 1 deletion synthtiger/utils/image_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,12 @@ def to_bbox(quad):

def merge_quad(quads):
quads = np.array(quads, dtype=np.float32)
topleft = np.amin(quads, axis=(0, 1))
try:
topleft = np.amin(quads, axis=(0, 1))
except Exception as e:
print(e)
print(quads)
raise Exception()
bottomright = np.amax(quads, axis=(0, 1))
width, height = bottomright - topleft
quad = np.array(
Expand Down