fixed PIL textsize versus textlength
This commit is contained in:
+3
-4
@@ -101,11 +101,10 @@ def ImgLabeler(img, text, size=72, color=(255,255,255)):
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Get text size
|
||||
text_size = draw.textsize(text, font=font)
|
||||
|
||||
text_size = draw.textlength(text, font=font)
|
||||
# Calculate x, y coordinates of the text
|
||||
x = (img.width - text_size[0]) / 2
|
||||
y = (img.height - text_size[1]) / 2
|
||||
x = (img.width - text_size) / 2
|
||||
y = (img.height - text_size) / 2
|
||||
|
||||
# Position for the text, centered
|
||||
text_position = (x, y)
|
||||
|
||||
@@ -6,7 +6,6 @@ import random
|
||||
from PIL import Image
|
||||
from .. import makeframeutils as mfu
|
||||
|
||||
|
||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||
|
||||
class BreakFrames:
|
||||
|
||||
Reference in New Issue
Block a user