From e7a098bdf58f5666158677557f349914caa6b46d Mon Sep 17 00:00:00 2001 From: Profitroll Date: Sun, 21 Jan 2024 17:28:57 +0100 Subject: [PATCH] RGB mode fixed --- src/huepaper/generator.py | 2 ++ src/huepaper/utils.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/huepaper/generator.py b/src/huepaper/generator.py index f9d0770..d365827 100644 --- a/src/huepaper/generator.py +++ b/src/huepaper/generator.py @@ -68,6 +68,8 @@ def generate( if emblem: image = add_emblem(image, emblem) + image = image.convert(mode="RGB") + if _output: save_image(image, _output) return diff --git a/src/huepaper/utils.py b/src/huepaper/utils.py index 38e889f..9fc5966 100644 --- a/src/huepaper/utils.py +++ b/src/huepaper/utils.py @@ -4,6 +4,7 @@ import random import numpy as np from colour import Color from PIL import Image, ImageDraw, ImageOps +from typing import Tuple, Union def get_base_color( @@ -83,7 +84,7 @@ def create_base_image(c1, c2, c3, c4, width=1920, height=1080) -> Image: return Image.fromarray(np.uint8(im_arr * 255)).convert("RGBA") -def add_lines(image, color): +def add_lines(image: Image, color: Tuple[float, float, float, Union[float, None]]) -> Image: """Add one to three random lines to an image with given color.""" width, height = image.size