From 0300ed2770e800fa6c41d54171e559f425715371 Mon Sep 17 00:00:00 2001 From: arbadacarba <63317640+arbadacarbaYK@users.noreply.github.com> Date: Wed, 29 May 2024 22:57:29 +0200 Subject: [PATCH] Update pixelateTG.py --- pixelateTG.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pixelateTG.py b/pixelateTG.py index f3595d0..d055de3 100644 --- a/pixelateTG.py +++ b/pixelateTG.py @@ -195,7 +195,7 @@ def process_image(photo_path, user_id, session_id, bot): roi = image[y:y+h, x:x+w] # Apply pixelation to the ROI - pixelation_size = int(PIXELATION_FACTOR * min(w, h)) + pixelation_size = max(1, int(PIXELATION_FACTOR * min(w, h))) # Ensure pixelation size is at least 1 pixelated_roi = cv2.resize(roi, (pixelation_size, pixelation_size), interpolation=cv2.INTER_NEAREST) pixelated_roi = cv2.resize(pixelated_roi, (w, h), interpolation=cv2.INTER_NEAREST) @@ -206,6 +206,7 @@ def process_image(photo_path, user_id, session_id, bot): cv2.imwrite(processed_path, image, [int(cv2.IMWRITE_JPEG_QUALITY), 95]) return processed_path + def button_callback(update: Update, context: CallbackContext) -> None: query = update.callback_query query.answer()