Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

hwc-chw-ndarray-conversion

Explicit, contiguous HWC <-> CHW ndarray conversion.

Usage

# coding=utf-8
import numpy as np
from hwc_chw_ndarray_conversion import (
    hwc_ndarray_to_chw_ndarray,
    chw_ndarray_to_hwc_ndarray
)

# An example image in HWC layout
hwc_ndarray = np.random.rand(64, 128, 10)  # shape: (height, width, channel)

# Convert to CHW layout
chw_ndarray = hwc_ndarray_to_chw_ndarray(hwc_ndarray)  # shape: (channel, height, width)
assert chw_ndarray.flags.c_contiguous

# Convert back to HWC layout
assert np.array_equal(chw_ndarray_to_hwc_ndarray(chw_ndarray), hwc_ndarray)

Installation

pip install hwc-chw-ndarray-conversion

Why this package?

Many libraries assume or demand a specific image channel ordering. hwc-chw-ndarray-conversion makes these assumptions explicit and self-documenting while providing best-practice array interop: always contiguous, always unambiguous.

Contributing

Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License.

Release files for hwc-chw-ndarray-conversion 0.1.0a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hwc-chw-ndarray-conversion 0.1.0a0
File Size Uploaded
hwc_chw_ndarray_conversion-0.1.0a0.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hwc-chw-ndarray-conversion 0.1.0a0
File Interpreter ABI Platform
hwc_chw_ndarray_conversion-0.1.0a0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 6.0 kB

Release files / hwc_chw_ndarray_conversion-0.1.0a0.tar.gz

Download URL hwc_chw_ndarray_conversion-0.1.0a0.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac8c2553a114df73ffc753b707c4b8dd46b6e7f2b7997ec98679a1c802999add
BLAKE2b-256 checksum
How to use checksums
0895f99263ef4cc357e4efe6b4dbd2146cdf58e6aa9913fc90176424807246a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / hwc_chw_ndarray_conversion-0.1.0a0-py2.py3-none-any.whl

Download URL hwc_chw_ndarray_conversion-0.1.0a0-py2.py3-none-any.whl
Size 3.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
78c03c6521de22245e2949cb46c633c8936dd9b100f221dbbd15bc3bcf408784
BLAKE2b-256 checksum
How to use checksums
e93be01f1864db2933740c86a851a5018590b390961fe1a79193e2ee716bb9dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0a0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page