Screenshot from background windows and adb - Windows only
Project description
Capture screen from background windows and adb (Windows only)
pip install windows-adb-screen-capture
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
Close
Hashes for windows_adb_screen_capture-0.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e3be556db648454abce283945a12264592d5c96f387131c93eaa91cba65d48a |
|
MD5 | 221219395ca2cc30a2f40c8908b8766a |
|
BLAKE2b-256 | a0f9fa781294ef093f73002744dfceede70ba63c69ba3891f308112f5c450cf7 |
Close
Hashes for windows_adb_screen_capture-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f39dcf0ed68b21ecd4fbac6b813aa0cd062404249120ee087c94a2914e2d02db |
|
MD5 | 0053043b00d477c95ef195870a19b4b5 |
|
BLAKE2b-256 | dcbcaa42dfb16d9d3e46739158919c4b51b8887003ad415adf537ff40d5f8982 |