(image_array)
| 95 | |
| 96 | |
| 97 | def encode_array_to_img_base64(image_array): |
| 98 | from PIL import Image |
| 99 | with BytesIO() as output_bytes: |
| 100 | pil_image = Image.fromarray(image_array.astype(np.uint8)) |
| 101 | pil_image.save(output_bytes, 'PNG') |
| 102 | bytes_data = output_bytes.getvalue() |
| 103 | base64_str = str(base64.b64encode(bytes_data), 'utf-8') |
| 104 | return 'data:image/png;base64,' + base64_str |
| 105 | |
| 106 | |
| 107 | def encode_pcm_to_base64(bytes_data): |
no test coverage detected
searching dependent graphs…