Screenshot from background windows, adb, full screen - Windows only
Project description
Capture screen from background windows and adb (Windows only)
pip install windows-adb-screen-capture
Update 2022/11/04
-
Screenshots can now be resized for imshow
-
Screenshots can be taken from the whole screen, and even multiple screens
-
Bugfix: Closing and reopening imshow is working now
from windows_adb_screen_capture import ScreenShots
sc2 = ScreenShots()
sc2.set_resize_ratio(50).choose_monitor_for_screenshot(0).imshow_screenshot_monitor() #0 for all screens, 1 for screen 1, 2 for screen 2...
Example with BlueStacks (using adb)
Open bluestacks
$adb connect localhost:5735 #connect to adb from shell or however you want
from windows_adb_screen_capture import ScreenShots
sc=ScreenShots(hwnd=None, adb_path=r"C:\ProgramData\adb\adb.exe", adb_serial='localhost:5735')
sc.imshow_adb(sleep_time=0.05, quit_key="e") #show captured screen
Edit screenshots before showing
import cv2
sc.enable_show_edited_images()
for x in range(120): #while True for endless loop
tmpscreenshot = sc.imget_adb() #get as numpy array
tmpscreenshort_inverted = cv2.bitwise_not(tmpscreenshot) #just an example, do your editing here
sc.show_edited_image(tmpscreenshort_inverted) #show the edited pic
sc.disable_show_edited_images() #back to normal screen capturing
Example with BlueStacks (using hwnd)
sc2 = ScreenShots()
sc2.find_window_with_regex('[bB]lue[sS]tacks.*')
sc2.imshow_hwnd(sleep_time=0.05, quit_key="q") #show captured screen
#capture screen and edit before showing
sc2.enable_show_edited_images()
for x in range(1000): #while True for endless loop
tmpscreenshot = sc2.imget_hwnd()
tmpscreenshort_inverted = cv2.bitwise_not(tmpscreenshot) #do your editing here
sc2.show_edited_image(tmpscreenshort_inverted) #show the edited pic
sc2.disable_show_edited_images() #back to normal screen capturing
Get screenshots without showing windows
from windowcapture import ScreenShots
sc=ScreenShots(hwnd=None, adb_path=r"C:\ProgramData\adb\adb.exe", adb_serial='localhost:5735')
sc.imget_adb()
sc2 = ScreenShots()
sc2.find_window_with_regex('[bB]lue[sS]tacks.*')
sc2.imget_hwnd()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file windows_adb_screen_capture-0.11.tar.gz
.
File metadata
- Download URL: windows_adb_screen_capture-0.11.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f9cad5f7f0a14a171b8093a587b59082309076d8300378f4c5deb1110ff5746 |
|
MD5 | 055e8cabef3493e9e5879ffd7baac80e |
|
BLAKE2b-256 | eada85379a3f1152ef2dd326d7bf4ff211a4b0273a74e2e8f348977c652e4816 |
File details
Details for the file windows_adb_screen_capture-0.11-py3-none-any.whl
.
File metadata
- Download URL: windows_adb_screen_capture-0.11-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff79d4056616b649d815ad5c2355515e87f8cec3a351bc4730e259b575b5d0f6 |
|
MD5 | 071b2b4c9de6cf7e99f0362a69ddde79 |
|
BLAKE2b-256 | 66395b721e4b2aabf5729018b484f4349bda9ba71bf867b1768c0efccd800cde |