onnew commited on
Commit
0cc401b
·
verified ·
1 Parent(s): d953bca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -19,7 +19,9 @@ except IOError:
19
  text = "Este é um exemplo de texto em uma imagem."
20
 
21
  # Calcular a posição do texto para centralizá-lo
22
- text_width, text_height = draw.textsize(text, font=font)
 
 
23
  text_x = (width - text_width) / 2
24
  text_y = (height - text_height) / 2
25
 
 
19
  text = "Este é um exemplo de texto em uma imagem."
20
 
21
  # Calcular a posição do texto para centralizá-lo
22
+ bbox = draw.textbbox((0, 0), text, font=font)
23
+ text_width = bbox[2] - bbox[0]
24
+ text_height = bbox[3] - bbox[1]
25
  text_x = (width - text_width) / 2
26
  text_y = (height - text_height) / 2
27