Spaces:
Running
Running
Update video.py
Browse files
video.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
from PIL import Image, ImageDraw, ImageFont
|
2 |
import os
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
def get_text_size(text, font):
|
7 |
bbox = font.getbbox(text)
|
@@ -58,6 +59,6 @@ def create_text_image(text,id,image_olst, image_size=(1280, 720), bg_color="whit
|
|
58 |
y += h + 23
|
59 |
image_name="slide"+str(id)+".png"
|
60 |
image_olst.append(image_name)
|
61 |
-
image_path=os.path.join(
|
62 |
image.save(image_path)
|
63 |
|
|
|
1 |
from PIL import Image, ImageDraw, ImageFont
|
2 |
import os
|
3 |
|
4 |
+
IMAGE_DIR = "/tmp/images"
|
5 |
+
os.makedirs(IMAGE_DIR, exist_ok=True)
|
6 |
|
7 |
def get_text_size(text, font):
|
8 |
bbox = font.getbbox(text)
|
|
|
59 |
y += h + 23
|
60 |
image_name="slide"+str(id)+".png"
|
61 |
image_olst.append(image_name)
|
62 |
+
image_path=os.path.join(IMAGE_DIR,image_name)
|
63 |
image.save(image_path)
|
64 |
|