适应屏幕分辨率
This commit is contained in:
parent
714355db97
commit
65042a7bc8
17
face_rec.py
17
face_rec.py
@ -699,16 +699,17 @@ class FaceRecognitionSystem:
|
||||
try:
|
||||
import screeninfo
|
||||
screen = screeninfo.get_monitors()[0]
|
||||
canvas_width = int(screen.width)
|
||||
canvas_height = int(screen.height)
|
||||
x_pos = 0
|
||||
y_pos = 0
|
||||
# 添加额外边距确保完全覆盖屏幕
|
||||
canvas_width = int(screen.width + 40)
|
||||
canvas_height = int(screen.height + 40)
|
||||
x_pos = -20 # 负偏移量居中
|
||||
y_pos = -20
|
||||
except Exception as e:
|
||||
self.logger.warning(f"无法获取屏幕信息,使用默认尺寸: {e}")
|
||||
canvas_width = max(qr_width * 2, 1920)
|
||||
canvas_height = max(qr_height, 1080)
|
||||
x_pos = 0
|
||||
y_pos = 0
|
||||
canvas_width = max(qr_width * 2, 1960)
|
||||
canvas_height = max(qr_height, 1120)
|
||||
x_pos = -20
|
||||
y_pos = -20
|
||||
|
||||
rendered = self._build_qrcode_instruction_canvas(qr_image, (canvas_width, canvas_height))
|
||||
if rendered is None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user