You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS C:\Users\hansh> php test.php
Grab: 7.558355093 s
But I expected this output instead:
PS C:\Users\hansh> php test.php
Grab: 0.58355093 s
Php needs about 7.5 seconds. For comparison, equivalent Python-mss+PIL code runs in about 0.26 seconds:
importtimeimportmssfromPILimportImage# 1. Grab Screent=time.perf_counter()
withmss.MSS() assct:
# monitors[1] is the primary monitor (monitors[0] is all monitors combined)monitor=sct.monitors[1]
sct_img=sct.grab(monitor)
# Convert raw MSS pixels (BGRA) to a PIL Image (RGB)img=Image.frombytes("RGB", sct_img.size, sct_img.bgra, "raw", "BGRX")
grab_time=time.perf_counter() -tprint(f"Grab: {grab_time:.9f} s")
PS C:\Users\hansh> python3 test.py
Grab: 0.265929600 s
PHP Version
Observed both windows 11 with
PHP 8.5.1 (cli) (built: Dec 17 2025 10:55:54) (ZTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.5.1, Copyright (c) Zend Technologies
with Zend OPcache v8.5.1, Copyright (c), by Zend Technologies
and Windows Server 2025 with
PHP 8.2.12 (cli) (built: Oct 24 2023 21:15:15) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
Operating System
Observed on both Windows Server 2025, and Windows 11, both x86-64
Activity
Fix GH-23459: Improve imagegrabscreen() performance on Windows (#23485)