Convert an image file to base64 string
(image_path)
| 10 | from tqdm import tqdm |
| 11 | |
| 12 | |
| 13 | def image_to_base64(image_path): |
| 14 | """Convert an image file to base64 string""" |
| 15 | with open(image_path, "rb") as f: |
| 16 | image_data = f.read() |
| 17 | return base64.b64encode(image_data).decode("utf-8") |
| 18 | |
| 19 |
no test coverage detected