@@ -136,27 +136,38 @@ def generate_image(self, post):
136136 total_height = len (lines ) * line_height
137137 y_start = (height - total_height ) // 2
138138
139- # Draw text with shadow for better readability
139+ # Draw text with strong outline for better readability
140140 for i , line in enumerate (lines ):
141141 bbox = draw .textbbox ((0 , 0 ), line , font = font )
142142 text_width = bbox [2 ] - bbox [0 ]
143143 x = (width - text_width ) // 2
144144 y = y_start + i * line_height
145145
146- # Shadow
147- draw .text ((x + 2 , y + 2 ), line , font = font , fill = (0 , 0 , 0 , 128 ))
148- # Main text
146+ # Draw black outline (multiple passes for thickness)
147+ outline_color = (0 , 0 , 0 )
148+ for offset_x in range (- 3 , 4 ):
149+ for offset_y in range (- 3 , 4 ):
150+ if offset_x != 0 or offset_y != 0 :
151+ draw .text ((x + offset_x , y + offset_y ), line , font = font , fill = outline_color )
152+
153+ # Main white text
149154 draw .text ((x , y ), line , font = font , fill = (255 , 255 , 255 ))
150155
151- # Add subtle tag indicator at bottom
156+ # Add tag indicator at bottom with outline
152157 tags = [t .caption for t in post .tags .all ()[:3 ]]
153158 if tags :
154159 tag_text = ' | ' .join (tags )
155160 try :
156- small_font = ImageFont .truetype ("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" , 20 )
161+ small_font = ImageFont .truetype ("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold .ttf" , 22 )
157162 except (IOError , OSError ):
158163 small_font = font
159- draw .text ((20 , height - 35 ), tag_text .upper (), font = small_font , fill = (255 , 255 , 255 , 180 ))
164+ tag_x , tag_y = 20 , height - 40
165+ # Outline for tags
166+ for ox in range (- 2 , 3 ):
167+ for oy in range (- 2 , 3 ):
168+ if ox != 0 or oy != 0 :
169+ draw .text ((tag_x + ox , tag_y + oy ), tag_text .upper (), font = small_font , fill = (0 , 0 , 0 ))
170+ draw .text ((tag_x , tag_y ), tag_text .upper (), font = small_font , fill = (255 , 255 , 255 ))
160171
161172 return image
162173
0 commit comments