autocrop-rs
Python bindings for the autocrop screenshot content-rectangle detector,
built with PyO3 and maturin. The package installs as autocrop-rs and
imports as autocrop_rs.
Build and test
Rust toolchain required (the extension is compiled on install):
cd python
uv sync # builds the extension into the venv via maturin
uv run pytest
uv sync --reinstall-package autocrop-rs # after changing Rust code (uv caches the build)
Released wheels are on PyPI: pip install autocrop-rs (or uv add autocrop-rs). To build one locally: uv run maturin build --release. The
wheel is abi3 for CPython 3.11 and newer.
Usage
import autocrop_rs
result = autocrop_rs.detect_file("screenshot.jpg")
if result: # truthy when a crop was found
x0, y0, x1, y1 = result.box # original pixel coordinates
print(result.reason, result.score)
# Encoded bytes (e.g. straight from an HTTP response or a database blob)
result = autocrop_rs.detect_bytes(data)
# An already decoded HxWx3 uint8 RGB array (numpy, or anything with the buffer protocol)
import numpy as np
from PIL import Image
result = autocrop_rs.detect_array(np.asarray(Image.open("screenshot.jpg").convert("RGB")))
# Detect and write the crop in one call (format by extension); writes nothing when box is None
autocrop_rs.crop_file("screenshot.jpg", "out/screenshot.png")
# Bytes in, bytes out: no decoding or re-encoding on the Python side
result, png = autocrop_rs.crop_bytes(data) # PNG by default
result, jpg = autocrop_rs.crop_bytes(data, format="jpeg", quality=85)
result = autocrop_rs.crop_bytes_to_file(data, "out/screenshot.webp") # format by extension
# Thresholds
params = autocrop_rs.Params(accept_score=0.5)
result = autocrop_rs.detect_file("screenshot.jpg", params)
params.to_dict() # every field and its value
All four functions release the GIL while decoding and detecting, so they can run in a thread pool.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autocrop_rs-0.1.0.tar.gz.
File metadata
- Download URL: autocrop_rs-0.1.0.tar.gz
- Upload date:
- Size: 893.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a32bbb369f1ef12fd4bfc255efde450b248ae3b72362d83d48aee6ae0d1a55e1
|
|
| MD5 |
14092fd7146a27349eb3e0f914bebe84
|
|
| BLAKE2b-256 |
c3777c8f30ba621899d67143388984f20ff6932f8045670e02c46884001aab53
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0.tar.gz:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0.tar.gz -
Subject digest:
a32bbb369f1ef12fd4bfc255efde450b248ae3b72362d83d48aee6ae0d1a55e1 - Sigstore transparency entry: 2730170854
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 820.8 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51bca3d4f5e0688b3314268e3d2a54d08b01d6ddc5b8178cdd469322dcbd7b2b
|
|
| MD5 |
c58002529c001c58583df8efbd50dc2f
|
|
| BLAKE2b-256 |
8fc89e644ca9221145f1867641b0d81da10b866c8eb9710447587fc88000cbf9
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-win_amd64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-win_amd64.whl -
Subject digest:
51bca3d4f5e0688b3314268e3d2a54d08b01d6ddc5b8178cdd469322dcbd7b2b - Sigstore transparency entry: 2730171530
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99f09b09c211b906ef5756f71dfda61d3eebf52402881019c9f70627d4337309
|
|
| MD5 |
6cc8027774c362921005a7fa5e691465
|
|
| BLAKE2b-256 |
479a171ed93bd21c8ff224a6fc5f777e4f306c8fb1506a241aad7d5961dbe0cb
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
99f09b09c211b906ef5756f71dfda61d3eebf52402881019c9f70627d4337309 - Sigstore transparency entry: 2730170976
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1892b74d7abf1790adf2236ef025a0b08627d329d83f8bbb6c0de15407313c43
|
|
| MD5 |
8fa0123c1b6ec8930d3105e6326b7d21
|
|
| BLAKE2b-256 |
0fdab36cf4d7d41171de32cc72e6f87d895028615c7136e1d23ade6b63aa1dcb
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
1892b74d7abf1790adf2236ef025a0b08627d329d83f8bbb6c0de15407313c43 - Sigstore transparency entry: 2730171748
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 920.5 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47e095a1f85733d6177c686e9554d5f492acd2e0394b7d3503e655221d9adb0b
|
|
| MD5 |
c44fce73a1406d1caa600cfdba8a1b2d
|
|
| BLAKE2b-256 |
29a252f20f82a885c4631cea6335daa02bc898266cf4023e2f441451a1464769
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
47e095a1f85733d6177c686e9554d5f492acd2e0394b7d3503e655221d9adb0b - Sigstore transparency entry: 2730171367
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 888.2 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90e21adc8848e4faf22f5f9582519e23020d01be4c87772aab9ce56cdd6ac4f5
|
|
| MD5 |
a48fc70a7607119613feb06c5b409afa
|
|
| BLAKE2b-256 |
4f878a80363c06782fcb73fd7eaa8f31f7394acc28c2170be7a9c29623edf12c
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
90e21adc8848e4faf22f5f9582519e23020d01be4c87772aab9ce56cdd6ac4f5 - Sigstore transparency entry: 2730171625
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 841.9 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0024e949c72f7dff90de833f07e4134a1a143cde9a2a1025900d25f8b84da65e
|
|
| MD5 |
b1735c36a72d3a01b4d729fa4cfdbd98
|
|
| BLAKE2b-256 |
b9b882df6feb2c800e9c3d72b766b2c7418daf6c4db32ef742ec04ef905a5938
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
0024e949c72f7dff90de833f07e4134a1a143cde9a2a1025900d25f8b84da65e - Sigstore transparency entry: 2730171115
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autocrop_rs-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: autocrop_rs-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 891.2 kB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06af12fa854c9e836e36e7c3e8823eb670b2ea365e200a423dac8cd17ed54669
|
|
| MD5 |
26702be094fa85919b6b1febc99f39e5
|
|
| BLAKE2b-256 |
5bd86252acdd71b87eeb57e17ff57943bc77444772f1786045037d918692327d
|
Provenance
The following attestation bundles were made for autocrop_rs-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on Nachtalb/autocrop-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autocrop_rs-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl -
Subject digest:
06af12fa854c9e836e36e7c3e8823eb670b2ea365e200a423dac8cd17ed54669 - Sigstore transparency entry: 2730171705
- Sigstore integration time:
-
Permalink:
Nachtalb/autocrop-rs@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Nachtalb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@da6c733a118f205f55d7db25fb693aa2dff87da5 -
Trigger Event:
push
-
Statement type: