gojiteji commited on
Commit
3a8a569
1 Parent(s): 0507cd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -142,7 +142,7 @@ def generate(logo=None, Vtubername=""):
142
 
143
  japanese_text = hiragana
144
 
145
- # Image setup
146
  tile_width, tile_height = int(font_size*1.4), int(font_size*1.4) # Size of individual tiles
147
  num_tiles = len(japanese_text)
148
  total_width = tile_width * num_tiles
@@ -176,10 +176,10 @@ def generate(logo=None, Vtubername=""):
176
  target_caption_height = int(logo_height)
177
 
178
  if caption.width > target_caption_width:
179
- aspect_ratio = caption.height / caption.width
180
- new_width = int(target_caption_width * aspect_ratio)
181
- new_height = int(target_caption_height * aspect_ratio)
182
-
183
  resized_caption = caption.resize((new_width, new_height), Image.ANTIALIAS)
184
  return resized_caption
185
  else:
 
142
 
143
  japanese_text = hiragana
144
 
145
+ # Image setup
146
  tile_width, tile_height = int(font_size*1.4), int(font_size*1.4) # Size of individual tiles
147
  num_tiles = len(japanese_text)
148
  total_width = tile_width * num_tiles
 
176
  target_caption_height = int(logo_height)
177
 
178
  if caption.width > target_caption_width:
179
+ aspect_ratio = caption.width / target_caption_width
180
+ new_width = int(caption.width * aspect_ratio * 0.4)
181
+ new_height = int(caption.height * aspect_ratio * 0.4)
182
+ print("resizing")
183
  resized_caption = caption.resize((new_width, new_height), Image.ANTIALIAS)
184
  return resized_caption
185
  else: