Skip to content

Commit

Permalink
Emoji are not being sorted correctly AUTOMATIC1111#192
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTOMATIC1111 committed Sep 10, 2022
1 parent ee8a6fa commit 6f678ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numpy as np
from PIL import Image, ImageFont, ImageDraw, PngImagePlugin
from fonts.ttf import Roboto
import string

import modules.shared
from modules.shared import opts
Expand Down Expand Up @@ -235,6 +236,7 @@ def resize_image(resize_mode, im, width, height):


invalid_filename_chars = '<>:"/\\|?*\n'
re_nonletters = re.compile(r'[\s'+string.punctuation+']+')


def sanitize_filename_part(text):
Expand All @@ -256,11 +258,11 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
pnginfo = None

if opts.save_to_dirs and not no_prompt:
words = re.findall(r'\w+', prompt or "")
words = re_nonletters.split(prompt or "")
if len(words) == 0:
words = ["empty"]

dirname = " ".join(words[0:opts.save_to_dirs_prompt_len])
dirname = " ".join(words[0:opts.save_to_dirs_prompt_len]).strip()
path = os.path.join(path, dirname)

os.makedirs(path, exist_ok=True)
Expand Down

0 comments on commit 6f678ec

Please sign in to comment.