MJaheen commited on
Commit
5f8c423
·
1 Parent(s): db4bc77

Add Font Size Feature

Browse files
Files changed (2) hide show
  1. src/app.py +2 -1
  2. src/utils/image_processor.py +3 -0
src/app.py CHANGED
@@ -255,6 +255,7 @@ def main():
255
  add_text = st.checkbox("Add Meme Text")
256
  top_text = st.text_input("Top Text") if add_text else ""
257
  bottom_text = st.text_input("Bottom Text") if add_text else ""
 
258
 
259
  # Main area
260
  col1, col2 = st.columns([1, 1])
@@ -328,7 +329,7 @@ def main():
328
 
329
  # Add text if requested
330
  if add_text and (top_text or bottom_text):
331
- image = processor.add_meme_text(image, top_text, bottom_text)
332
 
333
  # Always add MJ signature
334
  image = processor.add_signature(image, signature="MJaheen", font_size=10, opacity=200)
 
255
  add_text = st.checkbox("Add Meme Text")
256
  top_text = st.text_input("Top Text") if add_text else ""
257
  bottom_text = st.text_input("Bottom Text") if add_text else ""
258
+ font_size = st.slider("Font Size", 10, 100, 40, 1)
259
 
260
  # Main area
261
  col1, col2 = st.columns([1, 1])
 
329
 
330
  # Add text if requested
331
  if add_text and (top_text or bottom_text):
332
+ image = processor.add_meme_text(image, top_text, bottom_text,font_size)
333
 
334
  # Always add MJ signature
335
  image = processor.add_signature(image, signature="MJaheen", font_size=10, opacity=200)
src/utils/image_processor.py CHANGED
@@ -70,11 +70,14 @@ class ImageProcessor:
70
  try:
71
  if font_path:
72
  font = ImageFont.truetype(font_path, font_size)
 
73
  else:
74
  font = ImageFont.truetype("impact.ttf", font_size)
 
75
  except:
76
  font = ImageFont.load_default()
77
  logger.warning("Using default font")
 
78
 
79
  # Add top text
80
  if top_text:
 
70
  try:
71
  if font_path:
72
  font = ImageFont.truetype(font_path, font_size)
73
+ print("there")
74
  else:
75
  font = ImageFont.truetype("impact.ttf", font_size)
76
+ print("here")
77
  except:
78
  font = ImageFont.load_default()
79
  logger.warning("Using default font")
80
+ print("fair")
81
 
82
  # Add top text
83
  if top_text: