JPEG XL support

This commit is contained in:
Disty0
2025-02-27 00:21:57 +03:00
parent b286304e5f
commit 9a415ba965
2 changed files with 189 additions and 1 deletions

View File

@@ -118,14 +118,16 @@ except:
# JPEG-XL on Linux
try:
from jxlpy import JXLImagePlugin
from library.jpeg_xl_util import get_jxl_size
IMAGE_EXTENSIONS.extend([".jxl", ".JXL"])
except:
pass
# JPEG-XL on Windows
# JPEG-XL on Linux and Windows
try:
import pillow_jxl
from library.jpeg_xl_util import get_jxl_size
IMAGE_EXTENSIONS.extend([".jxl", ".JXL"])
except:
@@ -1156,6 +1158,8 @@ class BaseDataset(torch.utils.data.Dataset):
)
def get_image_size(self, image_path):
if image_path.endswith(".jxl"):
return get_jxl_size(image_path)
return imagesize.get(image_path)
def load_image_with_face_info(self, subset: BaseSubset, image_path: str, alpha_mask=False):