Skip to content

Commit

Permalink
Update pixelateTG.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arbadacarbaYK authored May 29, 2024
1 parent c4a1369 commit 0300ed2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pixelateTG.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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()
Expand Down

0 comments on commit 0300ed2

Please sign in to comment.