Skip to content

freetype font and pillow #13498

Open
Open
@vahidajalluian

Description

It seems in Pillow library version over 9.5 getsize method has been removed. So either change the method or limit the library to be installed to 9.5.
Here is the log I get for now.

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/vahidajalluian/yolov5-7.0/utils/plots.py", line 305, in plot_images
    annotator.box_label(box, label, color=color)
  File "/home/vahidajalluian/yolov5-7.0/utils/plots.py", line 91, in box_label
    w, h = self.font.getsize(label)  # text width, height
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
Exception in thread Thread-6 (plot_images):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/vahidajalluian/yolov5-7.0/utils/plots.py", line 305, in plot_images
    annotator.box_label(box, label, color=color)
  File "/home/vahidajalluian/yolov5-7.0/utils/plots.py", line 91, in box_label
    w, h = self.font.getsize(label)  # text width, height
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesDependencies and packages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions