mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-18 01:30:02 +00:00
works without ImageCms
This commit is contained in:
@@ -66,7 +66,12 @@ from library import custom_train_functions
|
||||
from library.original_unet import UNet2DConditionModel
|
||||
from huggingface_hub import hf_hub_download
|
||||
import numpy as np
|
||||
from PIL import Image, ImageCms
|
||||
import sys
|
||||
from PIL import Image
|
||||
try:
|
||||
from PIL import ImageCms
|
||||
except:
|
||||
print( "ImageCms not available. Images will not be converted to sRGB. Colours may be handled incorrectly." )
|
||||
import imagesize
|
||||
import cv2
|
||||
import safetensors.torch
|
||||
@@ -2494,6 +2499,7 @@ def load_image(image_path, alpha=False):
|
||||
raise Exception( f"{image_path} is animated" )
|
||||
|
||||
# Convert image to sRGB
|
||||
if "PIL.ImageCms" in sys.modules:
|
||||
icc = image.info.get('icc_profile', '')
|
||||
if icc:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user