# get_image_from_path

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/media_utils/get_image_from_path)

Read and encode an image file from disk.

## Signature

```python
get_image_from_path(
    path: pathlib.Path,
) -> ImageData | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `pathlib.Path` | Yes | Path to the image file. |

## Returns

`ImageData | None`

`ImageData` when the file is a valid image, otherwise `None`.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/1f5aa621cce7d89395d2db1533f81a299d059a7a/libs/code/deepagents_code/media_utils.py#L126)