AMfeta99 commited on
Commit
8b801a7
·
verified ·
1 Parent(s): 3a2a66c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,7 +11,7 @@ def add_label_to_image(image, label):
11
 
12
  # Define font size and color (adjust font path for your environment)
13
  font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Example font path
14
- font_size = 60 # Larger font size for better visibility
15
  try:
16
  font = ImageFont.truetype(font_path, font_size)
17
  except:
@@ -20,7 +20,7 @@ def add_label_to_image(image, label):
20
  # Calculate the size and position of the text (aligned to the left)
21
  text_bbox = draw.textbbox((0, 0), label, font=font)
22
  text_width, text_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
23
- position = (20, image.height - text_height - 20) # Left-aligned with margin
24
 
25
  # Add a semi-transparent rectangle behind the text for better visibility
26
  rect_margin = 10
 
11
 
12
  # Define font size and color (adjust font path for your environment)
13
  font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Example font path
14
+ font_size = 30 # Larger font size for better visibility
15
  try:
16
  font = ImageFont.truetype(font_path, font_size)
17
  except:
 
20
  # Calculate the size and position of the text (aligned to the left)
21
  text_bbox = draw.textbbox((0, 0), label, font=font)
22
  text_width, text_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
23
+ position = (image.height - text_height - 20, 20) # right-aligned with margin
24
 
25
  # Add a semi-transparent rectangle behind the text for better visibility
26
  rect_margin = 10