From a60f95f52f724f5cfd6d515139a6234a097d211f Mon Sep 17 00:00:00 2001 From: arbadacarba <63317640+arbadacarbaYK@users.noreply.github.com> Date: Wed, 29 May 2024 22:45:51 +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 a7fc192..8a9f03a 100644 --- a/pixelateTG.py +++ b/pixelateTG.py @@ -195,7 +195,8 @@ def process_image(photo_path, user_id, session_id, bot): roi = image[y:y+h, x:x+w] # Apply pixelation to the ROI - roi = cv2.resize(roi, (PIXELATION_FACTOR, PIXELATION_FACTOR), interpolation=cv2.INTER_NEAREST) + pixelation_size = int(PIXELATION_FACTOR * min(w, h)) + roi = cv2.resize(roi, (pixelation_size, pixelation_size), interpolation=cv2.INTER_NEAREST) roi = cv2.resize(roi, (w, h), interpolation=cv2.INTER_NEAREST) # Replace the original face region with the pixelated ROI