this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bug: fix rotation

+7 -1
+7 -1
src/camera_server.py
··· 10 10 import websockets 11 11 import asyncio 12 12 import json 13 + from PIL import Image 13 14 14 15 # Setup logging 15 16 logger = logging.getLogger('camera_server') ··· 259 260 config = picam2.create_still_configuration(main={"size": Config.PHOTO_RESOLUTION}) 260 261 picam2.configure(config) 261 262 picam2.start() 262 - picam2.set_controls({"Rotate": Config.ROTATION}) 263 263 time.sleep(Config.CAMERA_SETTLE_TIME) 264 264 265 265 timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") ··· 269 269 270 270 picam2.capture_file(filepath) 271 271 logger.info("Photo taken successfully") 272 + 273 + # Rotate the image using PIL 274 + with Image.open(filepath) as img: 275 + rotated_img = img.rotate(Config.ROTATION, expand=True) 276 + rotated_img.save(filepath) 277 + logger.info("Photo rotated successfully") 272 278 273 279 # Notify websocket clients about new photo 274 280 asyncio.run(notify_clients('new_photo', {