alpha
Login
or
Join now
dunkirk.sh
/
inky
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
bug: fix rotation
author
Kieran Klukas
date
1 year ago
(Apr 13, 2025, 7:03 PM -0400)
commit
b7884bb6
b7884bb6de4ec960325dfb7f4abecdcd92fa3bc4
parent
fd2c785f
fd2c785ff0f8a6f97584afaa3f0fbd80431ffa6f
+7
-1
1 changed file
Expand all
Collapse all
Unified
Split
src
camera_server.py
+7
-1
src/camera_server.py
Reviewed
···
10
10
import websockets
11
11
import asyncio
12
12
import json
13
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
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
272
+
273
273
+
# Rotate the image using PIL
274
274
+
with Image.open(filepath) as img:
275
275
+
rotated_img = img.rotate(Config.ROTATION, expand=True)
276
276
+
rotated_img.save(filepath)
277
277
+
logger.info("Photo rotated successfully")
272
278
273
279
# Notify websocket clients about new photo
274
280
asyncio.run(notify_clients('new_photo', {