feat: Increase max font size for captions
Increase the maximum font size for captions to 100 and adjust the font size calculation to use 20% of the image height. This allows for larger and more readable text on larger images.
This commit is contained in:
parent
32eecffdd0
commit
e68e1467a7
@ -14,7 +14,7 @@ class CaptionCog(commands.Cog, name="Caption"):
|
|||||||
CAPTION_PADDING = 10
|
CAPTION_PADDING = 10
|
||||||
DEFAULT_GIF_DURATION = 100
|
DEFAULT_GIF_DURATION = 100
|
||||||
MIN_FONT_SIZE = 10
|
MIN_FONT_SIZE = 10
|
||||||
MAX_FONT_SIZE = 50
|
MAX_FONT_SIZE = 100 # Increased max font size
|
||||||
TEXT_COLOR = (0, 0, 0) # Black text
|
TEXT_COLOR = (0, 0, 0) # Black text
|
||||||
BAR_COLOR = (255, 255, 255) # White bar
|
BAR_COLOR = (255, 255, 255) # White bar
|
||||||
|
|
||||||
@ -36,10 +36,8 @@ class CaptionCog(commands.Cog, name="Caption"):
|
|||||||
gif = Image.open(io.BytesIO(image_bytes))
|
gif = Image.open(io.BytesIO(image_bytes))
|
||||||
frames = []
|
frames = []
|
||||||
|
|
||||||
# Determine font size (e.g., 10% of image height, capped)
|
# Determine font size (e.g., 20% of image height, capped)
|
||||||
min_font_size = 10
|
font_size = max(self.MIN_FONT_SIZE, min(self.MAX_FONT_SIZE, int(gif.height * 0.2)))
|
||||||
max_font_size = 50
|
|
||||||
font_size = max(min_font_size, min(max_font_size, int(gif.height * 0.1)))
|
|
||||||
|
|
||||||
font = None
|
font = None
|
||||||
for font_choice in self.preferred_fonts:
|
for font_choice in self.preferred_fonts:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user