checkcorruptedimages
Python module to check for corrupted images by fully decoding them with Pillow in crash-isolated worker processes.
Installation
Install with uv
uv add checkcorruptedimages
Install as a CLI tool
uv tool install checkcorruptedimages
Install with pip
pip install -U checkcorruptedimages
No system dependencies: Pillow is installed automatically.
HEIC/HEIF support
pip install -U "checkcorruptedimages[heif]"
Installs pillow-heif; the decoder workers register it automatically, so .heic/.heif files can be checked (e.g. --ext heic on the CLI).
Command line
checkcorruptedimages ~/Pictures
checkcorruptedimages ~/Pictures --ext jpg --ext png --lenient --timeout 120 -v
Prints one corrupted path per line (a summary goes to stderr) and exits with code 1 if any corrupted image was found. See checkcorruptedimages --help for all options. With uv you can try it without installing:
uvx checkcorruptedimages ~/Pictures
Usage
In [1]: import checkcorruptedimages
In [2]: from pathlib import Path
In [3]: m = checkcorruptedimages.CheckCorruptedImages(verbose=True)
In [4]: m.get_corrupted_images(
folder_to_check=Path("/home/user/Pictures"),
file_extensions_list=["jpg"]
)
Path: /home/user/Pictures/notcorruptedimage.jpg, corrupted: False
Path: /home/user/Pictures/corruptedimage.jpg, corrupted: True, reason: OSError: image file is truncated (14 bytes not processed)
Out[4]: [PosixPath('/home/user/Pictures/corruptedimage.jpg')]
To also get the reason for each file, use get_check_results, which returns ImageCheckResult(file_path, corrupted, reason) records:
In [5]: m.get_check_results(
folder_to_check=Path("/home/user/Pictures"),
file_extensions_list=["jpg"]
)
For many separate calls, keep the decoder workers alive with a session:
In [6]: with m.session() as s:
...: s.is_image_corrupted(Path("/home/user/Pictures/a.jpg"))
...: s.check_files([Path("/home/user/Pictures/b.jpg")])
Behavior
- Every image is fully decoded with Pillow inside a pool of persistent worker subprocesses. A decoder crash or hang only kills a worker: the image is reported as corrupted (reason
decoder crashedortimeout), the worker is respawned and the batch continues. - The folder is scanned recursively and file extensions are matched case-insensitively.
- With
regard_warnings=True(default), truncated files that would still partially decode and Pillow warnings (e.g. decompression bombs overMAX_IMAGE_PIXELS) count as corruption; API-deprecation warnings are never escalated. Withregard_warnings=False, only files Pillow cannot decode at all are reported. - Each image check is limited to
timeoutseconds (default: 60). Usetimeout=Noneto disable the limit. max_worker_memory(bytes;--max-memory-mbon the CLI) applies a best-effort memory cap to each decoder worker on POSIX; a decode over the cap is reported as corrupted.on_result=receives eachImageCheckResultas it completes; useful for progress reporting.- Options can be passed to the constructor or set as attributes:
verbose,regard_warningsandtimeout. - The package ships type hints (
py.typed), checked with mypy in strict mode.
Metadata
Release files for checkcorruptedimages 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| checkcorruptedimages-1.0.0.tar.gz | 11.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| checkcorruptedimages-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 kB
Release files / checkcorruptedimages-1.0.0.tar.gz
| Download URL | checkcorruptedimages-1.0.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b87c377afa08417efbc7b0cf946c542a6815069404e74bb1b4982992d577ce7
|
|
BLAKE2b-256 checksum How to use checksums |
0f5f5270eb9357c5820514c75ae738026006f68e713785a2e74339d560657e0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / checkcorruptedimages-1.0.0-py3-none-any.whl
| Download URL | checkcorruptedimages-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68497b2c6493a06754fdb5e4957dce116841328d05b676bf45b578b95c3e6698
|
|
BLAKE2b-256 checksum How to use checksums |
ddb762dfeedb8d86568914ee3a8f1fde6fe5cf42f00d76d0ef5a791aa749ce4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logSecurity for checkcorruptedimages 1.0.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for checkcorruptedimages-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logA 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.