Pixel-Canon
PyPI Homepage | GitHub Repository | Specification
The canon for pixel data topology. A cross-language specification to define the logical layout of images (axis order, orientation, and memory order).
Pixel-Canon is a cross-language project aimed at solving a common and frustrating problem in computer vision, image processing, and machine learning: the ambiguity of image data layouts. When you receive an N-dimensional array, what do the axes mean? Is it (Height, Width, Channels) or (Channels, Height, Width)? Does the Y-axis point up or down?
This project provides a simple, declarative specification and a set of tools to describe this information explicitly, eliminating guesswork and making data pipelines more robust and reliable.
Python Implementation
This package contains the Python implementation of the Pixel-Canon spec.
Installation
pip install pixel-canon
To include support for numpy arrays:
pip install "pixel-canon[numpy]"
Quick Example
import numpy as np
from pixel_canon import CommonLayouts
from pixel_canon.backends.numpy_backend import convert_numpy
# Your image from a source like OpenCV
image_from_opencv = np.zeros((480, 640, 3), dtype=np.uint8)
layout_from_opencv = CommonLayouts.HWC_ROW_MAJOR_RGB
# The layout required by a library like PyTorch
layout_for_pytorch = CommonLayouts.CHW_ROW_MAJOR_RGB
# Convert the image layout safely and explicitly
prepared_image = convert_numpy(
image_from_opencv,
src=layout_from_opencv,
dst=layout_for_pytorch
)
print(f"Original shape: {image_from_opencv.shape}")
print(f"Converted shape: {prepared_image.shape}")
# Original shape: (480, 640, 3)
# Converted shape: (3, 480, 640)
For full documentation, source code for other languages, and to contribute, please visit our main GitHub Repository.
Metadata
Release files for pixel-canon 0.1.3
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 | Actions |
|---|---|---|---|---|
| pixel_canon-0.1.3.tar.gz | 12.0 kB | Without provenance | Details for pixel_canon-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pixel_canon-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pixel_canon-0.1.3-py3-none-any.whl |
Total release size: 21.6 kB
Release files / pixel_canon-0.1.3.tar.gz
| Download URL | pixel_canon-0.1.3.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
762cfb3090065384f78bef88bac35d99155ff7f9d57454b8a4c8cd13377ea760
|
|
BLAKE2b-256 checksum How to use checksums |
9701ee6f52d1e5bc1fa2fef10d9b55edda59e5449c5f67585c5e65f9f90d4c38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / pixel_canon-0.1.3-py3-none-any.whl
| Download URL | pixel_canon-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
591e3154cd62e4d2dd6b196f88dff0dd84085b43d05d60afc11fc0c8f2be830f
|
|
BLAKE2b-256 checksum How to use checksums |
e58d1ed6b20134486b4de95c4586a632832f0b9bfab7af5b5a056d9a19ca5e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for pixel-canon 0.1.3
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.