sreepathi-ravikumar commited on
Commit
8738a69
·
verified ·
1 Parent(s): 8c36521

Update video.py

Browse files
Files changed (1) hide show
  1. video.py +8 -16
video.py CHANGED
@@ -58,25 +58,17 @@ def create_text_image(text,id,image_olst, image_size=(1280, 720), bg_color="whit
58
 
59
  heading_color = "#0033cc" # Deep attractive blue
60
  normal_color = text_color # Usually black
61
-
62
  y = (image_size[1] - total_height) // 2
63
  for line in best_lines:
64
- x = 80 # Left padding
65
- y_line = y
66
-
67
- words = line.split()
68
- for word in words:
69
- is_bold = word.startswith("*") and word.endswith("*")
70
- clean_word = word.strip("*") if is_bold else word
71
 
72
- font_to_use = ImageFont.truetype(bold_font_path, best_font.size) if is_bold else best_font
73
- color_to_use = heading_color if is_bold else normal_color
74
-
75
- w, h = get_text_size(clean_word + " ", font_to_use)
76
- draw.text((x, y_line), clean_word + " ", font=font_to_use, fill=color_to_use)
77
- x += w
78
-
79
- y += get_text_size(line, best_font)[1] + 23
80
  image_name="slide"+str(id)+".png"
81
  image_olst.append(image_name)
82
  image_path=os.path.join(IMAGE_DIR,image_name)
 
58
 
59
  heading_color = "#0033cc" # Deep attractive blue
60
  normal_color = text_color # Usually black
61
+
62
  y = (image_size[1] - total_height) // 2
63
  for line in best_lines:
64
+ is_heading = line.strip().endswith("?") or line.strip().endswith(";")
65
+ font_to_use = ImageFont.truetype(bold_font_path, best_font.size) if is_heading else best_font
66
+ color_to_use = heading_color if is_heading else normal_color
 
 
 
 
67
 
68
+ w, h = get_text_size(line, font_to_use)
69
+ x = 80 # Left padding
70
+ draw.text((x, y), line, font=font_to_use, fill=color_to_use)
71
+ y += h + 23
 
 
 
 
72
  image_name="slide"+str(id)+".png"
73
  image_olst.append(image_name)
74
  image_path=os.path.join(IMAGE_DIR,image_name)