Skip to main content

Zero-dependency image processing library

Project description

Zignal Python Bindings

PyPI version Python versions Downloads License: MIT

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 12 color models (Rgb/Rgba, Hsl/Hsv, Lab/Lch, Xyz/Xyb, Oklab/Oklch, Lms, Ycbcr) with automatic conversion
Canvas & Fonts Lines, arcs, splines, polygons, flood fills, bitmap font text rendering
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), running statistics

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.10 – 3.14 (CPython)
  • Prebuilt wheels ship for:
    • Linux (manylinux2014) x86_64, aarch64
    • macOS x86_64 and arm64
    • Windows x86_64
  • Building from source requires Zig 0.15.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 → sixel → sgr fallback)
print(f"{img:auto}")

# Save
img.save("out.png")

Documentation & Support

Development

zig build python-bindings          # build extension + stubs
cd bindings/python
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

zignal_processing-0.10.0-cp314-cp314-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.14Windows x86-64

zignal_processing-0.10.0-cp314-cp314-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

zignal_processing-0.10.0-cp314-cp314-macosx_13_0_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.14macOS 13.0+ x86-64

zignal_processing-0.10.0-cp314-cp314-macosx_13_0_arm64.whl (6.5 MB view details)

Uploaded CPython 3.14macOS 13.0+ ARM64

zignal_processing-0.10.0-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

zignal_processing-0.10.0-cp313-cp313-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

zignal_processing-0.10.0-cp313-cp313-macosx_13_0_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.13macOS 13.0+ x86-64

zignal_processing-0.10.0-cp313-cp313-macosx_13_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

zignal_processing-0.10.0-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

zignal_processing-0.10.0-cp312-cp312-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

zignal_processing-0.10.0-cp312-cp312-macosx_13_0_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

zignal_processing-0.10.0-cp312-cp312-macosx_13_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

zignal_processing-0.10.0-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

zignal_processing-0.10.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

zignal_processing-0.10.0-cp311-cp311-macosx_13_0_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

zignal_processing-0.10.0-cp311-cp311-macosx_13_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

zignal_processing-0.10.0-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

zignal_processing-0.10.0-cp310-cp310-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

zignal_processing-0.10.0-cp310-cp310-macosx_15_0_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10macOS 15.0+ x86-64

zignal_processing-0.10.0-cp310-cp310-macosx_13_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

Details for the file zignal_processing-0.10.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3f0bdb1881f96955526ecb6636e481499b405fecbdec87cf72d642b8c7969899
MD5 aabc63eab80d74fc29d6db77ea5b136e
BLAKE2b-256 5c7b1a12dda7a201afa7f2d420d9c724462c2d297a4b012df57f45dea46b6c7e

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64230eeefcf32533602bbca02dda7c791c3be83acd8dea388f1bac84652a7305
MD5 7ad548649ce10c6e7e4156abebed0784
BLAKE2b-256 eed433d8ce64ec7fe8e503da6f39f66797684cdd9119898dd305ba2ab55c1903

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp314-cp314-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp314-cp314-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 e63436eb2699a8e4dd65064c52366858b848cfad7e059e1c6a7ab32a5b1988d5
MD5 1a12087c2b5a7e572bb2ca6a500e6c18
BLAKE2b-256 32e15b9ec18a0b83654b18f6385b8388d3b38d14a1acf310cbcf7aac326539d4

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp314-cp314-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp314-cp314-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 683f9c9b0f3416618edcac32dbc8766a58c15721322ce20bc582fa2fbf457516
MD5 cbd29a3d951cf3a63b9f25a9346c69a3
BLAKE2b-256 e8afd3d4ee6b6c70f9c016b0a90c15e21438b13893aa521b1c184b5c72662c6b

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e635418e01eebdd55403b6a9a14638b534b33e2139b0424c90eb75a798c8be05
MD5 9224fe97b8ca9a34634e9d24add3d39f
BLAKE2b-256 642109dfe05b21e93fcd3604949f26c7021d7ec76cb28cfba7b957997e1c94c8

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dbe9cf3055b4553962dc10b2303eb08319e916166f93e12cc7c1c8ece487bca6
MD5 cd4120e9deada935590846628c2d9b9a
BLAKE2b-256 e753bab7506339b6e7e162804edfc2011bdca12082462001fed6ef11c1e80ada

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp313-cp313-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 fe003854f20ec5aa611fd78ae1590757bdf5f0d90d89ee981d677699ff9953b9
MD5 8047eceaabcc9dd85fb0e57a21360dc1
BLAKE2b-256 5980b339f942ad9aa3e5a125a4c5392329991688c5282b37f1b4851f6f761328

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 9662bc6d62f9f83a107557c2f7def655e96f45e2f76b09d34014cf11d1caa7c0
MD5 0aa5e62e0f50d2cceb12d33543789024
BLAKE2b-256 1b9bfc398f069229bc072c1ec5c36675bdb2fc026a1d19d4821c53ae93226927

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 032776e4b2f6cada1c8a764c03e1f8966b9c025a09e3dd9253d418c30aeac3d8
MD5 2937673c6a6c85fc772ea25dd82dfa56
BLAKE2b-256 ce90e9268b2a4a8a8a286b81c37d641f58569fc40e9cf9bd90bccfd427e4e904

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cda370bd1abee3c3e905dc95f6f6202707bc5cdd41a188376b10480f257ac68a
MD5 926f80a1009dc35735df0fac0a9efb5a
BLAKE2b-256 4737a9d84dec27c4eec1ec08b4b06c99d41cdded22c767bbf75e3092ff58783d

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 4d456a1d8af754e7839d4be542773be20ddaa3c4d718d956692982ea81645f29
MD5 405cebf78842de783316e49a8f5881b1
BLAKE2b-256 2c23c7a4944bf643082d2cb056a2663120c9f18d10c431ae6b1e449f1d7e329c

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 6c954481298829dc5ed596df8b55a2ca1ebac7bdd6eb66f4d51583a45a2b5dd4
MD5 0141d419041b2dfc0a57535aaefcbe42
BLAKE2b-256 3ecb3666c0abbe4d1dd45e7598fdc0e451ba787df8a356846e40d68541d233d9

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 64336475f64aa3ca85babdd09caa7612f7c27a0c219aa91c7d4a2620f39bef8e
MD5 7c406187c1dcb5c445771a2706b9da1f
BLAKE2b-256 d9d0056b71eb9ff7a8e4d56537e4170a7aa3c2e825c249bce6b0836ca7bbe0ef

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3938beb1ad9e5b96bad71f3ecc9ebd866f7cef61cf46a3d4b827eae7f0560c0e
MD5 b263fb66fa4eca575372dbf10a9b1d93
BLAKE2b-256 61f95edcae00f8809ed631c72ddbb8f30dcbec5ac1c951c37e254b0d91a41d63

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 1ca62294fff48199667883413f53e2b1ed55ee282a61f1708d66ddaf0abb4e26
MD5 071710fdb96997e451c58c8fd7a9484e
BLAKE2b-256 f7c4d562d2c62e56ff0e1729ce9727b52b57cf51b2a94f340f1c5b26fa7d36f3

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 3baa9a5fdb28ce566ac2fe51abcb4eb9e26799d363cd0546b7535da2e8c5be08
MD5 9cce9ebe2b91d1c45b7938947ae203a7
BLAKE2b-256 92657cdb100eb388fb098aef11998c7832ade9424ae774970b67356d0602f804

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3866aba1563a376405a30b75315006f8518f5d291f3e03dfa315e3f643b555e3
MD5 f6dab3f9f2b0261d376754669f3f807e
BLAKE2b-256 2bc47a7f1498d9acfe0aaa6557bc3db27bc33d74fb6b79687fcd3967d6af064d

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ffb98ef212f5cd46ffb6d6577fe760322415e10cf7ddae9be35b55cd67af089f
MD5 6ab5352568ffa8158646a5722bcaa6c0
BLAKE2b-256 86258bdbd4de15a4d25f766b11a6575cf932b1f5bfa875edfefccec49dbae374

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp310-cp310-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 5c99ab4ae688c1ce19b4bada52b2fbbc8a4b13fa7e38f92c7558473574a03318
MD5 6261185966e5042919ec1641d46e1418
BLAKE2b-256 1b900ded3b98587137f5cc08c1216cc2a6b7ce9984d275676c8601e3b2776150

See more details on using hashes here.

File details

Details for the file zignal_processing-0.10.0-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zignal_processing-0.10.0-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 f14d98172664ad3a3440cdff3d8f8909ea140ee8b70432322da69ab038c459a4
MD5 cfc14be905fb236b88134f3a752ba451
BLAKE2b-256 51a611dae9365bc6f99034272753cd82249917848463a6e8a91c1dbbc064fe30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page