mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-01-27 03:19:47 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab9c2e2b27 | ||
|
|
4fbf54acd0 |
@@ -13,6 +13,8 @@ import numpy as np
|
||||
import piexif
|
||||
import piexif.helper
|
||||
from PIL import Image, ImageFont, ImageDraw, ImageColor, PngImagePlugin, ImageOps
|
||||
from PIL import __version__ as pillow_version
|
||||
from pkg_resources import parse_version
|
||||
# pillow_avif needs to be imported somewhere in code for it to work
|
||||
import pillow_avif # noqa: F401
|
||||
import string
|
||||
@@ -168,9 +170,18 @@ def draw_grid_annotations(im, width, height, hor_texts, ver_texts, margin=0):
|
||||
for line in lines:
|
||||
fnt = initial_fnt
|
||||
fontsize = initial_fontsize
|
||||
while drawing.multiline_textsize(line.text, font=fnt)[0] > line.allowed_width and fontsize > 0:
|
||||
fontsize -= 1
|
||||
fnt = get_font(fontsize)
|
||||
if parse_version(pillow_version) >= parse_version('10.0.0'):
|
||||
# New code for Pillow 10.0.0+
|
||||
text_width, text_height = drawing.multiline_textbbox((0, 0), line.text, font=fnt)[2:]
|
||||
while text_width > line.allowed_width and fontsize > 0:
|
||||
fontsize -= 1
|
||||
fnt = get_font(fontsize)
|
||||
text_width, text_height = drawing.multiline_textbbox((0, 0), line.text, font=fnt)[2:]
|
||||
else:
|
||||
# Old code for Pillow versions below 10.0.0
|
||||
while drawing.multiline_textsize(line.text, font=fnt)[0] > line.allowed_width and fontsize > 0:
|
||||
fontsize -= 1
|
||||
fnt = get_font(fontsize)
|
||||
drawing.multiline_text((draw_x, draw_y + line.size[1] / 2), line.text, font=fnt, fill=color_active if line.is_active else color_inactive, anchor="mm", align="center")
|
||||
|
||||
if not line.is_active:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
setuptools==69.5.1 # temp fix for compatibility with some old packages
|
||||
GitPython==3.1.32
|
||||
Pillow==9.5.0
|
||||
Pillow==10.4.0
|
||||
accelerate==0.31.0
|
||||
blendmodes==2022
|
||||
blendmodes==2024.1.1
|
||||
clean-fid==0.1.35
|
||||
diskcache==5.6.3
|
||||
einops==0.4.1
|
||||
@@ -14,7 +14,7 @@ inflection==0.5.1
|
||||
jsonmerge==1.8.0
|
||||
kornia==0.6.7
|
||||
lark==1.1.2
|
||||
numpy==1.26.2
|
||||
numpy==1.26.4
|
||||
omegaconf==2.2.3
|
||||
open-clip-torch==2.20.0
|
||||
piexif==1.1.3
|
||||
|
||||
Reference in New Issue
Block a user