Skip to content

Commit

Permalink
Merge pull request #6341 from radarhere/imagedraw
Browse files Browse the repository at this point in the history
Only import ImageFont in ImageDraw when necessary
  • Loading branch information
hugovk committed Jun 5, 2022
2 parents b37f2d1 + e961774 commit 418820a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/PIL/ImageDraw.py
Expand Up @@ -33,7 +33,7 @@
import math
import numbers

from . import Image, ImageColor, ImageFont
from . import Image, ImageColor

"""
A simple 2D drawing interface for PIL images.
Expand Down Expand Up @@ -667,6 +667,8 @@ def textbbox(

if font is None:
font = self.getfont()
from . import ImageFont

if not isinstance(font, ImageFont.FreeTypeFont):
raise ValueError("Only supported for TrueType fonts")
mode = "RGBA" if embedded_color else self.fontmode
Expand Down

0 comments on commit 418820a

Please sign in to comment.