# wandb.data\_types.Image

[![](https://www.tensorflow.org/images/GitHub-Mark-32px.png)View source on GitHub](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/sdk/data_types.py#L1527-L1997)

Wandb class for images.

```python
Image(
    data_or_path: "ImageDataOrPathType",
    mode: Optional[str] = None,
    caption: Optional[str] = None,
    grouping: Optional[str] = None,
    classes: Optional[Union['Classes', Sequence[dict]]] = None,
    boxes: Optional[Union[Dict[str, 'BoundingBoxes2D'], Dict[str, dict]]] = None,
    masks: Optional[Union[Dict[str, 'ImageMask'], Dict[str, dict]]] = None
) -> None
```

| Arguments      |                                                                                                                                                                            |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data_or_path` | (numpy array, string, io) Accepts numpy array of image data, or a PIL image. The class attempts to infer the data format and converts it.                                  |
| `mode`         | (string) The PIL mode for an image. Most common are "L", "RGB", "RGBA". Full explanation at <https://pillow.readthedocs.io/en/4.2.x/handbook/concepts.html#concept-modes>. |
| `caption`      | (string) Label for display of image.                                                                                                                                       |

## Methods

### `all_boxes` <a href="#all_boxes" id="all_boxes"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/sdk/data_types.py#L1946-L1967)

```python
@classmethod
all_boxes(
    images: Sequence['Image'],
    run: "LocalRun",
    run_key: str,
    step: Union[int, str]
) -> Union[List[Optional[dict]], bool]
```

### `all_captions` <a href="#all_captions" id="all_captions"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/sdk/data_types.py#L1969-L1973)

```python
@classmethod
all_captions(
    images: Sequence['Media']
) -> Union[bool, Sequence[Optional[str]]]
```

### `all_masks` <a href="#all_masks" id="all_masks"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/sdk/data_types.py#L1923-L1944)

```python
@classmethod
all_masks(
    images: Sequence['Image'],
    run: "LocalRun",
    run_key: str,
    step: Union[int, str]
) -> Union[List[Optional[dict]], bool]
```

### `guess_mode` <a href="#guess_mode" id="guess_mode"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/sdk/data_types.py#L1817-L1831)

```python
guess_mode(
    data: "np.ndarray"
) -> str
```

Guess what type of image the np.array is representing

### `to_uint8` <a href="#to_uint8" id="to_uint8"></a>

[View source](https://www.github.com/wandb/client/tree/v0.10.31.dev1/wandb/sdk/data_types.py#L1833-L1855)

```python
@classmethod
to_uint8(
    data: "np.ndarray"
) -> "np.ndarray"
```

Converts floating point image on the range \[0,1] and integer images on the range \[0,255] to uint8, clipping if necessary.

| Class Variables |         |
| --------------- | ------- |
| MAX\_DIMENSION  | `65500` |
| MAX\_ITEMS      | `108`   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://arig23498.gitbook.io/aritra-documentation/ref/python/data-types/image.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
