Zignal Python Bindings
Zero-dependency image processing primitives written in Zig and packaged for Python.
Feature Overview
| Area | Highlights |
|---|---|
| Images | PNG/JPEG load/save, resize & warp, crop/letterbox, insert/extract, Gaussian/median filters, motion blur |
| Pixels & Arrays | Direct indexing/assignment, slice updates, zero-copy NumPy interop both directions |
| Colors | 13 color models (Rgb/Rgba, Hsl/Hsv, Lab/Lch, Xyz/Xyb, Oklab/Oklch, Lms, Ycbcr, Cmyk) with automatic conversion |
| Canvas & Fonts | Lines, arcs, splines, polygons, flood fills, text rendering with bitmap (BDF/PCF) and TrueType fonts |
| Geometry | Rectangle algebra, convex hulls, similarity/affine/projective transforms |
| Terminal Output | SGR, Braille, Sixel, and Kitty renderers with automatic format negotiation |
| Numerics | Matrices with rich linear algebra, PCA, optimization (Hungarian assignment + MaxLIPO+TR global optimizer), running statistics |
| QR Codes | Encode text/bytes to QR images and decode them back, including from photos (perspective, uneven lighting, rotation) |
All functionality is implemented in Zig with no runtime dependencies, making the wheel lightweight and easy to vendor.
Installation
pip install zignal-processing
- Python 3.11 – 3.15 (CPython)
- Prebuilt wheels ship for:
- Linux
x86_64(manylinux_2_28) - macOS
arm64 - Windows
x86_64
- Linux
- Building from source requires Zig 0.17.0 or newer available on your
PATH.
If CPython headers/libraries are in a non-standard location, set PYTHON_INCLUDE_DIR, PYTHON_LIBS_DIR, and PYTHON_LIB_NAME before installing.
Quickstart
import numpy as np
import zignal
# Load or create an image
img = zignal.Image.load("photo.jpg") # PNG/JPEG
canvas = zignal.Image(480, 640, color=zignal.Rgb(30, 144, 255)).canvas()
# Draw & process
canvas.draw_circle((120, 160), 60, zignal.Rgba(255, 255, 255, 180), fill=True)
img = img.gaussian_blur(1.5)
img = img.resize(0.5, zignal.Interpolation.BILINEAR)
# Pixels + NumPy (shared memory views)
img[10, 20] = zignal.Hsv(60, 100, 100)
np_view = img.to_numpy() # (rows, cols, 3) uint8 view
np_view[..., 0] = np.clip(np_view[..., 0] + 32, 0, 255) # modifies img in-place
img2 = zignal.Image.from_numpy(np_view) # zero-copy back into Zig
# Streaming stats & procedural noise
stats = zignal.RunningStats()
for value in np_view.mean(axis=-1).flat:
stats.add(float(value))
noise = zignal.perlin(0.2, 0.4, amplitude=1.2, frequency=2.5, octaves=4)
print(f"μ={stats.mean:.3f} σ={stats.std_dev:.3f} perlin={noise:.3f}")
# Terminal preview (auto: kitty → iterm2 → sixel → sgr fallback)
print(f"{img:auto}")
# Save
img.save("out.png")
Documentation & Support
- Docs: https://arrufat.github.io/zignal/python/zignal.html
- Source: https://github.com/arrufat/zignal
- Issues: https://github.com/arrufat/zignal/issues
Development
zig build python # build extension + stubs (from the repo root)
cd bindings/python # or here: `zig build` (extension) / `zig build stubs`
uv venv && uv pip install -e . # editable install
uv run pytest -q # run tests
Building Wheels
To build a wheel for your current platform:
cd bindings/python
uv run python -m build --wheel
To cross-compile or specify optimization:
ZIG_TARGET=x86_64-linux-gnu ZIG_OPTIMIZE=ReleaseFast uv run python -m build --wheel
Environment Variables
| Variable | Description | Default |
|---|---|---|
ZIG_TARGET |
Zig target triple | native |
ZIG_OPTIMIZE |
Optimization mode (Debug, ReleaseSafe, ReleaseFast, ReleaseSmall) |
ReleaseFast |
ZIG_CPU |
CPU micro-architecture (e.g., baseline, x86_64_v3) |
baseline |
For portable Linux wheels, it is recommended to run auditwheel repair on the resulting wheel. On macOS, use delocate-wheel.
Contributing Bindings
Follow the bindings guide for argument parsing helpers, enum registration, image ownership, and stub generation.
Sponsors
Special thanks to B Factory, Inc, the Founding Sponsor of Zignal. They originally developed this library and graciously transferred ownership to the community to ensure its long-term maintenance and growth.
License
MIT
Metadata
Release files for zignal-processing 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 29.3 MB
Release files / zignal_processing-0.11.0-cp315-cp315-win_amd64.whl
| Download URL | zignal_processing-0.11.0-cp315-cp315-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.15 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1faf0adb93474a03a50677909d9599ec50e3cd7ba7d8a39cd446ee9aa9b23e93
|
|
BLAKE2b-256 checksum How to use checksums |
cfadaccef860703bcf129f3f35f86636dc46f21f0d23d6cfb90440bca7a52ca5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp315-cp315-manylinux_2_28_x86_64.whl
| Download URL | zignal_processing-0.11.0-cp315-cp315-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.15 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e4370dc50a29778ea4c10578f816418f826a3a018398d2c56eaeae510bbed8ff
|
|
BLAKE2b-256 checksum How to use checksums |
9d4b5135acae18caa20617ff188208384bc15d08c79c8a6c876886a417c1acc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp315-cp315-macosx_15_0_arm64.whl
| Download URL | zignal_processing-0.11.0-cp315-cp315-macosx_15_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.15 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b7fae7ca555617c021b44759d589dfb1f77127115d69becb1de84110c09bdaa8
|
|
BLAKE2b-256 checksum How to use checksums |
513fcfc3235ab316098b27d8189e325d256b96b814459666d89c0f9805e0a616
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp314-cp314-win_amd64.whl
| Download URL | zignal_processing-0.11.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
800a0759cda77772cf2cdde9f05a50a39bf61d665ede2717af5d164d716efaff
|
|
BLAKE2b-256 checksum How to use checksums |
02b6bdf8889609f739fc93c91040be542b0d8170855e5c6992812c66c774ab9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | zignal_processing-0.11.0-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
194846aa879359d838596126b0dd0cb4c5b0b14e2c106e56c7ea63e2d2a7f90b
|
|
BLAKE2b-256 checksum How to use checksums |
e1411f44df15733f7df954e2cc964691a77bdd731af604af38fcd8fe44331f95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp314-cp314-macosx_15_0_arm64.whl
| Download URL | zignal_processing-0.11.0-cp314-cp314-macosx_15_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.14 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0a3ab7a11fa4661d4fd6c7147f7b171d6c4fd02355d37d1a3353518d6ec03ef1
|
|
BLAKE2b-256 checksum How to use checksums |
165dbd7a5e880fc9ee46b8535ae504a5f3ed4dfd1a755c50db9d798d3a2a00e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp313-cp313-win_amd64.whl
| Download URL | zignal_processing-0.11.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
93b9448722bdd5a4e5e6e60d5aa16a8f0e02efbd5a63b47d808409eeb70669b3
|
|
BLAKE2b-256 checksum How to use checksums |
7a3589685428a542bc5a98d6949bbd63486ea539127619373dc3611bc54ca2fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | zignal_processing-0.11.0-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
adce6dcd95b2e98a55c57b28a0b81a2ee35ffa612555f79335bc38d7909a00c2
|
|
BLAKE2b-256 checksum How to use checksums |
fce249118c7d6f4f6c61104b78f3c403245bb28deb3ef53abd40a22b3152f0be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | zignal_processing-0.11.0-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fc053fa8733cd3fa87172c0837a2c46acaec174033230d3df7bc2afc888c1a89
|
|
BLAKE2b-256 checksum How to use checksums |
43289575c2cb3c8570bd246db0ed1c707ab0e407de5dab81ba186455cda72230
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp312-cp312-win_amd64.whl
| Download URL | zignal_processing-0.11.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a46396fb1be06fe84e2f43f55a06ab5897de4b90c4967784c347167ee3e69967
|
|
BLAKE2b-256 checksum How to use checksums |
d7a4514e37e5d616b8b195d5fd12ee1049ded82dc3c96b540e51c8b9c4feb413
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | zignal_processing-0.11.0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a5c90f6ac5dfed789b34799c9016702c976dc7f64cc294ebd9dfcf8a37f5a75e
|
|
BLAKE2b-256 checksum How to use checksums |
c5d4cc7847bd8c3b03a00a64950323b608b5f6a3c8641c531a6f6da412a847e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | zignal_processing-0.11.0-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a759a84a5b875f9772ed0e735aa5170f55575bbcbdb79df291fdba611b43071f
|
|
BLAKE2b-256 checksum How to use checksums |
7932ee22bb03e0b6b10fbbfbfcecf6573709bf8a3ca3cac6004af3c9aee34b8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp311-cp311-win_amd64.whl
| Download URL | zignal_processing-0.11.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
42f504633ffa38ded59c3a620af85b25bc8b2c6cd4a5745c8ad330ff9c3ea255
|
|
BLAKE2b-256 checksum How to use checksums |
b3ad5c1bd087d29867acacd41444025ff8e4b48519c5c113102742fd99f37cf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | zignal_processing-0.11.0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
31e08d0bf0965de6a9ed5a243deeaa5cb91406655b1599aa6f2a0c3a3bfb3094
|
|
BLAKE2b-256 checksum How to use checksums |
52fb7b186dd4ebbfc76f2fb41f4dde324edaf752406fc80d5a23a4a93f955029
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zignal_processing-0.11.0-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | zignal_processing-0.11.0-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
db9c04e2a77274d77496156f57f2bf65c13a7e1e1c730042863490c49ba97bf0
|
|
BLAKE2b-256 checksum How to use checksums |
06bbbd1fefd1ab45cf815e4b4dd900c8ac217bf703e27693267350f677d760bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|