From a6e97966b33fdc33b91d2b3ad711a6ec90c01da4 Mon Sep 17 00:00:00 2001 From: meetwq Date: Sat, 17 Aug 2024 22:15:37 +0800 Subject: [PATCH] fix possible overflow in color_mask --- pil_utils/build_image.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pil_utils/build_image.py b/pil_utils/build_image.py index a0545b3..c2377e0 100644 --- a/pil_utils/build_image.py +++ b/pil_utils/build_image.py @@ -335,7 +335,7 @@ def color_mask(self, color: ColorType) -> "BuildImage": rgb_sum = sum(color) for i in range(h): for j in range(w): - value = img_gray[i, j] + value = int(img_gray[i, j]) new_color = ( [ int(value * r / rgb_sum), diff --git a/pyproject.toml b/pyproject.toml index 565b553..a4c4501 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pil-utils" -version = "0.1.11" +version = "0.1.12" description = "A simple PIL wrapper and text-to-image tool" authors = ["meetwq "] license = "MIT"