Skip to content

Commit

Permalink
Merge pull request #7021 from radarhere/getmask2
Browse files Browse the repository at this point in the history
Do not render text if image has zero width or height
  • Loading branch information
radarhere committed Mar 31, 2023
2 parents eba0245 + 80edcd1 commit eeaee75
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,18 +767,19 @@ def getmask2(
offset = offset[0] - stroke_width, offset[1] - stroke_width
Image._decompression_bomb_check(size)
im = fill("RGBA" if mode == "RGBA" else "L", size, 0)
self.font.render(
text,
im.id,
mode,
direction,
features,
language,
stroke_width,
ink,
start[0],
start[1],
)
if min(size):
self.font.render(
text,
im.id,
mode,
direction,
features,
language,
stroke_width,
ink,
start[0],
start[1],
)
return im, offset

def font_variant(
Expand Down

0 comments on commit eeaee75

Please sign in to comment.