qqwjq1981 commited on
Commit
82ea981
·
verified ·
1 Parent(s): e2e15a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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="white", outline="black", outline_width=2):
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.85)).set_opacity(0.9)
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: