Convert an HWC BGR 888 or BGRX 8888 NumPy ndarray to an HWC RGB 888 PIL.Image, with the alpha/unused channel discarded.
Project description
hwc-bgrx-8888-ndarray-to-pil-image
Convert an HWC BGR 888 or BGRX 8888 NumPy ndarray to an HWC RGB 888 PIL.Image, with the alpha/unused channel discarded.
This function helps bridge interoperability between Qt, OpenCV (which often use HWC BGRX 8888 images), and PIL.
Installation
pip install hwc-bgrx-8888-ndarray-to-pil-image
Usage
import numpy as np
from hwc_bgrx_8888_ndarray_to_pil_image import hwc_bgrx_8888_ndarray_to_pil_image
# Example: create a dummy BGRX image
hwc_bgrx = np.random.randint(0, 256, (224, 224, 4), dtype=np.uint8)
pil_image = hwc_bgrx_8888_ndarray_to_pil_image(hwc_bgrx) # <PIL.Image.Image image mode=RGB size=224x224>
pil_image.show()
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0.tar.gz.
File metadata
- Download URL: hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9591ffbe48c56885d6dc03ef9790abdcd8e852d6339b6a4f7995d9c0d7bedb17
|
|
| MD5 |
956b1e9c4f8685d735f4e2e0467df171
|
|
| BLAKE2b-256 |
60cd52eaab5287d636d4c0802ba7377693ada5e75bf924bc1f8fdb4c21dc9882
|
File details
Details for the file hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0-py2.py3-none-any.whl.
File metadata
- Download URL: hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0-py2.py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f80b1f07b3183661d3eb5e0699bf35bcb662c1b5f95985ebe0c7f3c2d2f03dd
|
|
| MD5 |
7db315fd460bb4159dad03c0ad460c35
|
|
| BLAKE2b-256 |
3951e7c225870b9ac20597640647213206d1c72ec0bad6449d0b37e086af112a
|