Skip to main content

screencap to ppm

Tested against Windows 10 / Python 3.11 / Anaconda / BlueStacks (Android 11 - rooted with Python installed)

pip install cythonscreencap2ppm

from cythonscreencap2ppm import (
    Screencaptaker,
    mount_memory_disk,
    remount_rw,
    convert_screencap2file,
    convert_screencap2np,
    get_all_sh,
    get_all_su,
    get_resolution,
    remount_rw,
    remount_rw_all_shell_su_combinations,
    unmount_memory_disk,
)
import os

os.environ["OMP_THREAD_LIMIT"] = "1"
mount_memory_disk(
    path="/media/ramdisk", mb=256, su="su", sh="sh", try_all_combinations=False
)

# class to take screenshots with screencap (raw RGB data - NOT PNG! ) and convert to PPM
self = Screencaptaker(
    path="/media/ramdisk",
    mb=256,
    sh="sh",
    pure_shot="pure_shot.raw",
    converted_shot="converted_shot.ppm",
    width=0,
    height=0,
    max_color_value=255,
)

counter = 0
while True:
    nparraybuf = self.get_screenshot_as_np()
    print(nparraybuf.shape, counter, end="\r")
    counter += 1

# Example of using remount_rw to attempt remounting the root filesystem as read-write
result, success = remount_rw("su", "sh")
# Convert a raw screenshot file to a PPM format and save it
convert_screencap2file(
    "/path/to/input.raw",
    "/path/to/output.ppm",
    max_color_value=255,
    width=0,
    height=0,
)
# Convert a raw screenshot file directly into a NumPy array
image_array = convert_screencap2np("/path/to/input.raw", width=0, height=0)
print("Image array shape:", image_array.shape)
# Retrieve all paths where the 'sh' shell executable is found
sh_paths = get_all_sh()
print("SH paths found:", sh_paths)
# Retrieve all paths where the 'su' executable is found
su_paths = get_all_su()
print("SU paths found:", su_paths)
# Get the screen resolution of the device
width, height = get_resolution()
print("Screen resolution:", width, "x", height)
# Try to remount the root filesystem as read-write using all combinations of 'su' and 'sh' paths
stdout_stderr, success = remount_rw_all_shell_su_combinations()
print("Remount attempt successful:", success)
# Unmount a previously mounted memory disk
result = unmount_memory_disk("/media/ramdisk", "su", "sh")
print("Unmount operation completed")
# Example of mounting a memory disk to a specified path with a defined size
mount_memory_disk(
    path="/media/ramdisk", mb=256, su="su", sh="sh", try_all_combinations=False
)
print("Memory disk mounted at /media/ramdisk with size 256MB")

Metadata

Release files for cythonscreencap2ppm 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cythonscreencap2ppm 0.11
File Size Uploaded Provenance Actions
cythonscreencap2ppm-0.11.tar.gz 27.9 kB Without provenance Details for cythonscreencap2ppm-0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cythonscreencap2ppm 0.11
File Interpreter ABI Platform Actions
cythonscreencap2ppm-0.11-py3-none-any.whl Python 3 none any Details for cythonscreencap2ppm-0.11-py3-none-any.whl

Total release size: 56.5 kB

Release files / cythonscreencap2ppm-0.11.tar.gz

Download URL cythonscreencap2ppm-0.11.tar.gz
Size 27.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a597614474a7fc3be6b92df5aba5f1bb8d5d09da84bf6736d818acaa8b0d24ec
BLAKE2b-256 checksum
How to use checksums
7877dec89a47ecf698b406e88883a05b65922d3f88409d7b67bdc349ba697253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / cythonscreencap2ppm-0.11-py3-none-any.whl

Download URL cythonscreencap2ppm-0.11-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
910d7dca304b686e16a0c3acab6359f0c33401b3b612b220f9af3dc92edc91df
BLAKE2b-256 checksum
How to use checksums
c9f8e90210187de2f25290fae3b037b54cb727a83e782ba8236eb079c4cd6788
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for cythonscreencap2ppm 0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page