(image_path: str)
| 4 | |
| 5 | |
| 6 | def encode_image_to_base64(image_path: str) -> str: |
| 7 | try: |
| 8 | with open(image_path, "rb") as image_file: |
| 9 | return base64.b64encode(image_file.read()).decode("utf-8") |
| 10 | except Exception as e: |
| 11 | raise ValueError(f"Failed to encode image to base64: {e}") |
| 12 | |
| 13 | |
| 14 | def get_image_mime_type(image_path: str) -> str: |
no outgoing calls