summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/sound_bot.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sound_bot.py b/src/sound_bot.py
index 833f5c2..dc9b2c1 100755
--- a/src/sound_bot.py
+++ b/src/sound_bot.py
@@ -26,6 +26,8 @@ from telegram.ext import (
MessageHandler
)
+from PIL import Image
+
logger = logging.getLogger(__name__)
RenderedContent = tuple[str, Optional[InlineKeyboardMarkup]]
record_client: Optional[RecordClient] = None
@@ -452,6 +454,13 @@ def camera_capture(ctx: Context) -> None:
if flash:
client.setflash(False)
+ camera_config = config['cameras'][cam]
+ if 'rotate' in camera_config:
+ im = Image.open(fd.name)
+ im.rotate(camera_config['rotate'], expand=True)
+ # im.show()
+ im.save(fd.name)
+
try:
with open(fd.name, 'rb') as f:
bot.send_photo(ctx.user_id, photo=f)