feat: image input and session optimize

This commit is contained in:
zhayujie
2023-11-27 12:47:00 +08:00
parent 061d8a3a5f
commit 4e675b84fb
6 changed files with 134 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
import io
import os
from urllib.parse import urlparse
from PIL import Image
@@ -49,3 +49,8 @@ def split_string_by_utf8_length(string, max_length, max_split=0):
result.append(encoded[start:end].decode("utf-8"))
start = end
return result
def get_path_suffix(path):
path = urlparse(path).path
return os.path.splitext(path)[-1].lstrip('.')