> ## Documentation Index
> Fetch the complete documentation index at: https://scaledfoundations-rebrand.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Client

## ImageClient

Inherits from: [ROSClient](/robot-api/grid/comm/ros/base_client#rosclient)

A ROS client for handling image messages.

This class inherits from ROSClient and provides functionality for publishing and
receiving image messages over ROS topics, with support for various image encodings
and formats.

### ImageClient

```python
ImageClient(client_dict, agent_dict)
```

Initialize the image client.

<ResponseField name="Arguments">
  <ParamField query="client_dict (dict)" type="" required>
    Configuration dictionary for the client
  </ParamField>

  <ParamField query="agent_dict (dict), optional" type="">
    defaults to None.
    Dictionary of agent parameters. Defaults to None.
  </ParamField>
</ResponseField>

### decode\_image

```python
ImageClient.decode_image(data, height, width, encoding)
```

Decode image data from ROS message format.

<ResponseField name="Arguments">
  <ParamField query="data (str)" type="" required>
    Base64 encoded image data
  </ParamField>

  <ParamField query="height (int)" type="" required>
    Image height in pixels
  </ParamField>

  <ParamField query="width (int)" type="" required>
    Image width in pixels
  </ParamField>

  <ParamField query="encoding (str)" type="" required>
    Image encoding format. Supported formats:

    * 'rgb8': 8-bit RGB color
    * 'bgr8': 8-bit BGR color (converted to RGB)
    * 'rgba8': 8-bit RGBA color (converted to RGB)
    * 'bgra8': 8-bit BGRA color (converted to RGB)
    * '32FC1': 32-bit floating point grayscale
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  Decoded image array in RGB format (for color images) or
  grayscale format (for '32FC1'). For RGB format, has shape (height, width, 3).
  For grayscale, has shape (height, width, 1).
</ResponseField>

### publish\_agent\_image

```python
ImageClient.publish_agent_image()
```

### publish\_image

```python
ImageClient.publish_image(data)
```

Publish an image to the configured topic.

<ResponseField name="Arguments">
  <ParamField query="data (numpy.ndarray)" type="" required>
    Image data to publish
  </ParamField>
</ResponseField>

### get\_image

```python
ImageClient.get_image()
```

Get the most recent processed image.

<ResponseField name="Returns">
  The most recent image data, or None if no image is available
</ResponseField>
