diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-18 07:12:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-18 07:12:17 +0000 |
commit | 182330ae40c93b761fced8d03bbdd8523f1739d0 (patch) | |
tree | c95f2e531cc34475eb39266add6d12a2a5e1e2b3 /modules/textual_inversion/image_embedding.py | |
parent | 0d31f20cbd556ea4ba3d8ad9254bcce71c32088c (diff) | |
parent | 983f2c494ad8fed2f08193681ba0bf5dda01555a (diff) | |
download | stable-diffusion-webui-gfx803-182330ae40c93b761fced8d03bbdd8523f1739d0.tar.gz stable-diffusion-webui-gfx803-182330ae40c93b761fced8d03bbdd8523f1739d0.tar.bz2 stable-diffusion-webui-gfx803-182330ae40c93b761fced8d03bbdd8523f1739d0.zip |
Merge branch 'dev' into ngrok-py
Diffstat (limited to 'modules/textual_inversion/image_embedding.py')
-rw-r--r-- | modules/textual_inversion/image_embedding.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/modules/textual_inversion/image_embedding.py b/modules/textual_inversion/image_embedding.py index 5593f88c..5858a55f 100644 --- a/modules/textual_inversion/image_embedding.py +++ b/modules/textual_inversion/image_embedding.py @@ -2,10 +2,8 @@ import base64 import json
import numpy as np
import zlib
-from PIL import Image, PngImagePlugin, ImageDraw, ImageFont
-from fonts.ttf import Roboto
+from PIL import Image, ImageDraw, ImageFont
import torch
-from modules.shared import opts
class EmbeddingEncoder(json.JSONEncoder):
@@ -17,7 +15,7 @@ class EmbeddingEncoder(json.JSONEncoder): class EmbeddingDecoder(json.JSONDecoder):
def __init__(self, *args, **kwargs):
- json.JSONDecoder.__init__(self, object_hook=self.object_hook, *args, **kwargs)
+ json.JSONDecoder.__init__(self, *args, object_hook=self.object_hook, **kwargs)
def object_hook(self, d):
if 'TORCHTENSOR' in d:
@@ -136,11 +134,8 @@ def caption_image_overlay(srcimage, title, footerLeft, footerMid, footerRight, t image = srcimage.copy()
fontsize = 32
if textfont is None:
- try:
- textfont = ImageFont.truetype(opts.font or Roboto, fontsize)
- textfont = opts.font or Roboto
- except Exception:
- textfont = Roboto
+ from modules.images import get_font
+ textfont = get_font(fontsize)
factor = 1.5
gradient = Image.new('RGBA', (1, image.size[1]), color=(0, 0, 0, 0))
|