Skip to main content

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


Download files

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

Source Distribution

hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0-py2.py3-none-any.whl (3.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0.tar.gz.

File metadata

File hashes

Hashes for hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 9591ffbe48c56885d6dc03ef9790abdcd8e852d6339b6a4f7995d9c0d7bedb17
MD5 956b1e9c4f8685d735f4e2e0467df171
BLAKE2b-256 60cd52eaab5287d636d4c0802ba7377693ada5e75bf924bc1f8fdb4c21dc9882

See more details on using hashes here.

File details

Details for the file hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for hwc_bgrx_8888_ndarray_to_pil_image-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6f80b1f07b3183661d3eb5e0699bf35bcb662c1b5f95985ebe0c7f3c2d2f03dd
MD5 7db315fd460bb4159dad03c0ad460c35
BLAKE2b-256 3951e7c225870b9ac20597640647213206d1c72ec0bad6449d0b37e086af112a

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