Image to base64 and back.
Project description
Library for converting RGB / Grayscale numpy images from to base64 and back.
Installation
pip install -U image_to_base_64
Conversion
Takes numpy.array or PIL.Image as input
RGB to base 64
base64 = rgb2base64(rgb_image, image_format)
where image format is JPEG, PNG
Grayscale to base 64
base64 = grayscale2base64(grayscale_image)
Base64 to RGB image
output_type = "cv2" # or "PIL"
rgb_image = base64_to_rgb(base64, output_type)
Base64 to Grayscale image
output_type = "cv2" # or "PIL"
grayscale_image = base64_to_grayscale(base64, output_type)
Issues
For some reason I cannot convert RGB image to JPEG representation in base 64 and back without losses.
=> test only for PNG and not JPEG
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
image2base64-0.0.5.tar.gz
(7.6 kB
view details)
File details
Details for the file image2base64-0.0.5.tar.gz.
File metadata
- Download URL: image2base64-0.0.5.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.8.2 requests/2.23.0 setuptools/63.4.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e93b792572f5849403b8f2e4075f0a8156ce9beaaec42dd5579bf9562ff0454
|
|
| MD5 |
e1d8385c250939b3b055181d30424630
|
|
| BLAKE2b-256 |
c50c39a6b56ce0092f2ccdde155ce6519b758071254a53561f1f60ad5b137a7a
|