-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
I just upgraded to Pillow 2.2.1 (from 2.1.0) and font drawing in my program is broken.
On 2.1.0, a draw operation like:
image = Image.open(self.image_path)
self.size = image.size # 640x480, in my case
top_dimensions = self.__get_text_dimensions(self.top_text, top_font_size) # (156, 25)
top_position = (self.size[0] - 5 - top_dimensions[0], 5)
draw = ImageDraw.Draw(image)
self.__draw_image(draw, self.top_text, top_font_size, top_position)
font = ImageFont.truetype(self.font, top_font_size)
stroke_width = 3
for x_off in range(-stroke_width, stroke_width + 1):
for y_off in range(-stroke_width, stroke_width + 1):
draw.text((top_position[0] + x_off, top_position[1] + y_off), self.top_text, STROKE_COLOR, font=font)
draw.text(top_position, self.top_text, TEXT_COLOR, font=font)
Would draw text with a 5px offset from the top. The draw operations in the nested for loops effectively add an outline to the text. After upgrading to 2.2.1, though, the offsets are different, and all text appears to be shifted down by about 7-10 pixels. I checked the changelogs, and don't see anything that directly addresses this behavior.
I can provide the full image drawing code, if needed.
Metadata
Metadata
Assignees
Labels
No labels