fix(config): fix invisible_watermark handling

This setting was hardcoded to True. Simplified logic around it to not have a conditional that does nothing.
This commit is contained in:
psychedelicious 2024-03-11 22:55:02 +11:00
parent 7ca447ded1
commit 22ac204678

View File

@ -10,9 +10,9 @@ from imwatermark import WatermarkEncoder
from PIL import Image
import invokeai.backend.util.logging as logger
from invokeai.app.services.config import InvokeAIAppConfig
from invokeai.app.services.config.config_default import get_config
config = InvokeAIAppConfig.get_config()
config = get_config()
class InvisibleWatermark:
@ -20,14 +20,8 @@ class InvisibleWatermark:
Wrapper around InvisibleWatermark module.
"""
@classmethod
def invisible_watermark_available(cls) -> bool:
return config.invisible_watermark
@classmethod
def add_watermark(cls, image: Image.Image, watermark_text: str) -> Image.Image:
if not cls.invisible_watermark_available():
return image
logger.debug(f'Applying invisible watermark "{watermark_text}"')
bgr = cv2.cvtColor(np.array(image.convert("RGB")), cv2.COLOR_RGB2BGR)
encoder = WatermarkEncoder()