lllyasviel / lllyasviel/stable-diffusion-webui-forge

AttributeError: 'ImageDraw' object has no attribute 'multiline_textsize'

Open
#2,984 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Hi, while trying to use the **X/Y/Z plot script** to compare different checkpoints, at the end of the images generation the final grid is not generated and I get this error on the terminal:

```
Traceback (most recent call last):
File "/home/software/forge-webui/modules_forge/main_thread.py", line 30, in work
self.result = self.func(*self.args, **self.kwargs)
File "/home/software/forge-webui/modules/txt2img.py", line 128, in txt2img_function
processed = modules.scripts.scripts_txt2img.run(p, *p.script_args)
File "/home/software/forge-webui/modules/scripts.py", line 792, in run
processed = script.run(p, *script_args)
File "/home/software/forge-webui/scripts/xyz_grid.py", line 793, in run
processed = draw_xyz_grid(
File "/home/software/forge-webui/scripts/xyz_grid.py", line 404, in draw_xyz_grid
grid = images.draw_grid_annotations(grid, grid_max_w, grid_max_h, hor_texts, ver_texts, margin_size)
File "/home/software/forge-webui/modules/images.py", line 228, in draw_grid_annotations
draw_texts(d, x, y, hor_texts[col], fnt, fontsize)
File "/home/software/forge-webui/modules/images.py", line 171, in draw_texts
while drawing.multiline_textsize(line.text, font=fnt)[0] > line.allowed_width and fontsize > 0:
AttributeError: 'ImageDraw' object has no attribute 'multiline_textsize'
'ImageDraw' object has no attribute 'multiline_textsize
```

I did some search beforehand, some people mention that the _Pillow package removed ImageDraw.multiline_textsize() form version 10.0_, the issue here is, I checked the **requirements_versions.txt** file on my Forge installation directory, and the Pillow version is 9.5.0.
These are the specs of my installation:

[f2.0.1v1.10.1-previous-669-gdfdcbab6](https://github.com/lllyasviel/stable-diffusion-webui-forge/commit/dfdcbab685e57677014f05a3309b48cc87383167)  •  python: 3.10.15  •  torch: 2.3.1+cu121  •  xformers: N/A  •  gradio: 4.40.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with scripts/xyz_grid.py at draw_xyz_grid and modules/images.py at draw_texts, following the traceback to the failing text-size call. Reproduce the X/Y/Z plot with the reported environment, then verify that the final annotated grid is generated without the AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.