# image_bytes_to_b64_string

> **Function** in `langchain_google_genai`

📖 [View in docs](https://reference.langchain.com/python/langchain-google-genai/_image_utils/image_bytes_to_b64_string)

Encodes image bytes into a b64 encoded string.

## Signature

```python
image_bytes_to_b64_string(
    image_bytes: bytes,
    encoding: str = 'ascii',
    image_format: str = 'png',
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `image_bytes` | `bytes` | Yes | Bytes of the image. |
| `encoding` | `str` | No | Type of encoding in the string. `'ascii'` by default. (default: `'ascii'`) |
| `image_format` | `str` | No | Format of the image. `'png'` by default. (default: `'png'`) |

## Returns

`str`

B64 image encoded string.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-google/blob/a3f016b2a6c4af535df275545f76fa7424aa39e5/libs/genai/langchain_google_genai/_image_utils.py#L239)