I want a stroke around the text, but when I use the built-in parameters of the text function, the border has rounded edges. I want the border to have sharp, cornered edges instead.
font = ImageFont.truetype(font_family_path, font_size)
temp_image = Image.new('RGBA', (1, 1), (0, 0, 0, 0))[In the attached image, you can see that currently, I have a stroke with rounded corners, but I want the border to have sharp edges.,](https://i.sstatic.net/mLETp0ZD.png)
draw = ImageDraw.Draw(temp_image)
bbox = draw.textbbox((0, 0), name, font=font)
text_width = bbox[2] - bbox[0]
text_height = bbox[3] - bbox[1]
image = Image.new('RGBA', (width, height), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
text_x = (width - text_width) / 2
text_y = (height - text_height) / 2 - (bbox[1] - 0)
draw.text((text_x, text_y), name, font=font, fill=(r, g, b),stroke_width=outline_width, stroke_fill=(stroke_r ,stroke_g, stroke_b))
I want sharp edges like those in the attached image.
New contributor
user26304417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.