Skip to content

Library for converting from RGB / GrayScale image to base64 and back.

License

Notifications You must be signed in to change notification settings

ternaus/base64ToImageConverters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4c0cf80 · Sep 19, 2022

History

9 Commits
Aug 24, 2022
Sep 19, 2022
Sep 19, 2022
Aug 24, 2022
Sep 19, 2022
Apr 8, 2022
Apr 7, 2022
Sep 19, 2022
Aug 24, 2022
Apr 8, 2022
Sep 19, 2022
Apr 8, 2022
Sep 19, 2022

Repository files navigation

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

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages