Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AttributeError: 'ImageDraw' object has no attribute 'multiline_textsize' #16558

Open
1 of 6 tasks
david-chainreactdev opened this issue Oct 17, 2024 · 1 comment
Open
1 of 6 tasks
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@david-chainreactdev
Copy link

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

I am using this google colab notebook https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb which install the latest version of your webui.
I try to do img2img => inpaint upload, then I select X/Y/Z Plot, I set the X type to Prompt S/R from the list, then I enter a value for example mall,bedroom and finally click in generate, it generates the image but in the end fails to display it with this error [Bug]: AttributeError: 'ImageDraw' object has no attribute 'multiline_textsize'

Steps to reproduce the problem

  1. Go to img2img
  2. Select Input Upload and upload files
  3. input prompt and negative prompt
  4. choose the script X/Y/Z Plot
  5. For X Type choose from the list Prompt S/R
  6. Input X Type values "mall,bedroom"
  7. Click on generate

What should have happened?

Generated image should be displayed properly and no error

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

sysinfo-2024-10-17-13-23.json

Console logs

Loading weights [88967f03f2] from /content/gdrive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion/juggernaut_final.safetensors
Creating model from config: /content/gdrive/MyDrive/sd/stable-diffusion-webui/configs/v1-inference.yaml
Running on public URL: https://5427cc1b69b8f33387.gradio.live
✔ Connected
Startup time: 15.1s (import torch: 8.6s, import gradio: 0.8s, setup paths: 0.9s, other imports: 0.5s, load scripts: 0.6s, create ui: 0.8s, gradio launch: 1.6s, add APIs: 1.2s).
Applying attention optimization: xformers... done.
Model loaded in 4.9s (load weights from disk: 1.2s, create model: 0.5s, apply weights to model: 2.1s, load textual inversion embeddings: 0.7s, calculate empty prompt: 0.2s).
100% 20/20 [00:09<00:00,  2.20it/s]
X/Y/Z plot will create 2 images on 1 2x1 grid. (Total steps to process: 40)
100% 20/20 [00:09<00:00,  2.18it/s]
100% 20/20 [00:09<00:00,  2.12it/s]
*** Error completing request
*** Arguments: ('task(n9dp069tm1booho)', <gradio.routes.Request object at 0x7e4bfdc11fc0>, 4, 'Photograph of cinematic photo realistic skin texture, photorealistic, raw portrait photo of 20 year old Ukrainina girl wearing white dress, big breast, neutral, diamond and angular face, grey eyes, straight and high nose, (with long purple pin curly hairstyle:1.5), (blemish pale skin, skin flaws:1.6), (freckles:1.7), 8k, realistic beautiful, gorgeous insanely detailed octane render, 35mgraph, film, bokeh, ultramodern, vibrant, professional, 4k, highly detailed background of mall, front view and side view', '(worst quality, low quality:1.4), (deformed, distorted, disfigured:1.2), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, blurry, amputation. tattoo, watermark, text, black and white photo', [], None, None, None, None, None, <PIL.Image.Image image mode=RGB size=1536x768 at 0x7E4BFDD8A1D0>, <PIL.Image.Image image mode=RGBA size=1536x768 at 0x7E4BFDD8AFB0>, 4, 0, 2, 1, 1, 9, 1.5, 0.95, 0.0, 768, 768, 1, 0, 1, 0, 0, '', '', '', [], False, [], '', 'upload', None, 8, False, 1, 0.5, 4, 0, 0.5, 2, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, 'start', '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 7, 'white dress,sport cloth', [], 0, '', [], 0, '', [], True, False, False, True, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 74, in f
        res = list(func(*args, **kwargs))
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 53, in f
        res = func(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/img2img.py", line 240, in img2img
        processed = modules.scripts.scripts_img2img.run(p, *args)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 780, in run
        processed = script.run(p, *script_args)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/scripts/xyz_grid.py", line 769, in run
        processed = draw_xyz_grid(
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/scripts/xyz_grid.py", line 380, in draw_xyz_grid
        grid = images.draw_grid_annotations(grid, grid_max_w, grid_max_h, hor_texts, ver_texts, margin_size)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/images.py", line 228, in draw_grid_annotations
        draw_texts(d, x, y, hor_texts[col], fnt, fontsize)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-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'

---
X/Y/Z plot will create 2 images on 1 2x1 grid. (Total steps to process: 40)
100% 20/20 [00:09<00:00,  2.07it/s]
100% 20/20 [00:10<00:00,  2.00it/s]
*** Error completing request
*** Arguments: ('task(fru5mdqk4k0ohne)', <gradio.routes.Request object at 0x7e4bfddd1c90>, 4, 'Photograph of cinematic photo realistic skin texture, photorealistic, raw portrait photo of 20 year old Ukrainina girl wearing white dress, big breast, neutral, diamond and angular face, grey eyes, straight and high nose, (with long purple pin curly hairstyle:1.5), (blemish pale skin, skin flaws:1.6), (freckles:1.7), 8k, realistic beautiful, gorgeous insanely detailed octane render, 35mgraph, film, bokeh, ultramodern, vibrant, professional, 4k, highly detailed background of mall, front view and side view', '(worst quality, low quality:1.4), (deformed, distorted, disfigured:1.2), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, blurry, amputation. tattoo, watermark, text, black and white photo', [], None, None, None, None, None, <PIL.Image.Image image mode=RGB size=1536x768 at 0x7E4BFDDD1FC0>, <PIL.Image.Image image mode=RGBA size=1536x768 at 0x7E4BFDDD1720>, 4, 0, 2, 1, 1, 9, 1.5, 0.95, 0.0, 768, 768, 1, 0, 1, 0, 0, '', '', '', [], False, [], '', 'upload', None, 8, False, 1, 0.5, 4, 0, 0.5, 2, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, 'start', '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 7, 'white dress,sport cloth', [], 0, '', [], 0, '', [], True, False, False, True, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 74, in f
        res = list(func(*args, **kwargs))
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 53, in f
        res = func(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/img2img.py", line 240, in img2img
        processed = modules.scripts.scripts_img2img.run(p, *args)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 780, in run
        processed = script.run(p, *script_args)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/scripts/xyz_grid.py", line 769, in run
        processed = draw_xyz_grid(
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/scripts/xyz_grid.py", line 380, in draw_xyz_grid
        grid = images.draw_grid_annotations(grid, grid_max_w, grid_max_h, hor_texts, ver_texts, margin_size)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/images.py", line 228, in draw_grid_annotations
        draw_texts(d, x, y, hor_texts[col], fnt, fontsize)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-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'

Additional information

No response

@david-chainreactdev david-chainreactdev added the bug-report Report of a bug, yet to be confirmed label Oct 17, 2024
@w-e-w
Copy link
Collaborator

w-e-w commented Oct 17, 2024

ImageDraw.multiline_textsize was remove in PIL 10.0.0
see https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#font-size-and-offset-methods

webui uses Pillow==9.5.0

base your sysinfo you have pillow==10.4.0 installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

2 participants