Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AV resize #191

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions clashroyalebuildabot/emulator/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from get_free_port import get_dynamic_ports
import kthread
from loguru import logger
from PIL import Image
import requests
from subprocesskiller import kill_pid
from subprocesskiller import kill_process_children_parents
Expand Down Expand Up @@ -227,16 +226,10 @@ def click(self, x, y):
def take_screenshot(self):
logger.debug("Starting to take screenshot...")
while self.frame is None:
time.sleep(0.01)
time.sleep(0.001)
frame, self.frame = self.frame, None
screenshot = (
frame.to_rgb()
.reformat(width=frame.width, height=frame.height, format="rgb24")
.to_ndarray()
)
screenshot = Image.fromarray(screenshot)
screenshot = screenshot.resize(
(SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT), Image.Resampling.BILINEAR
)
screenshot = frame.reformat(
width=SCREENSHOT_WIDTH, height=SCREENSHOT_HEIGHT, format="rgb24"
).to_image()

return screenshot