Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -394,7 +394,7 @@ def create_subtitle_clip_pil(text, start_time, end_time, video_width, video_heig
|
|
| 394 |
img = Image.new("RGBA", (subtitle_width, total_height), (0, 0, 0, 0))
|
| 395 |
draw = ImageDraw.Draw(img)
|
| 396 |
|
| 397 |
-
def draw_text_with_outline(draw, pos, text, font, fill="
|
| 398 |
x, y = pos
|
| 399 |
# Draw outline
|
| 400 |
for dx in range(-outline_width, outline_width + 1):
|
|
@@ -413,7 +413,7 @@ def create_subtitle_clip_pil(text, start_time, end_time, video_width, video_heig
|
|
| 413 |
y += line_heights[idx] + 5
|
| 414 |
|
| 415 |
img_np = np.array(img)
|
| 416 |
-
txt_clip = ImageClip(img_np).set_start(start_time).set_duration(end_time - start_time).set_position(("center", video_height * 0.
|
| 417 |
return txt_clip
|
| 418 |
|
| 419 |
except Exception as e:
|
|
|
|
| 394 |
img = Image.new("RGBA", (subtitle_width, total_height), (0, 0, 0, 0))
|
| 395 |
draw = ImageDraw.Draw(img)
|
| 396 |
|
| 397 |
+
def draw_text_with_outline(draw, pos, text, font, fill="yellow", outline="black", outline_width=2):
|
| 398 |
x, y = pos
|
| 399 |
# Draw outline
|
| 400 |
for dx in range(-outline_width, outline_width + 1):
|
|
|
|
| 413 |
y += line_heights[idx] + 5
|
| 414 |
|
| 415 |
img_np = np.array(img)
|
| 416 |
+
txt_clip = ImageClip(img_np).set_start(start_time).set_duration(end_time - start_time).set_position(lambda clip: ("center", video_height - clip.h - int(video_height * 0.05))).set_opacity(0.9)
|
| 417 |
return txt_clip
|
| 418 |
|
| 419 |
except Exception as e:
|