Skip to main content

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

Metadata

Release files for image2base64 0.0.5

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

Source distribution (sdist)

Source distribution for image2base64 0.0.5
File Size Uploaded
image2base64-0.0.5.tar.gz 7.6 kB Details

Release files / image2base64-0.0.5.tar.gz

Download URL image2base64-0.0.5.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e93b792572f5849403b8f2e4075f0a8156ce9beaaec42dd5579bf9562ff0454
BLAKE2b-256 checksum
How to use checksums
c50c39a6b56ce0092f2ccdde155ce6519b758071254a53561f1f60ad5b137a7a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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