> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ImageClient

> ImageClient

```python theme={null}
from grid_sim_client.isaac import ImageClient
```

## Constructor

```python Signature theme={null}
ImageClient(
    *,
    client_dict: dict,
    agent_dict: Optional[dict] = None,
    shared_session: Any = None,
)
```

## Methods

### `getLatestMessage()`

```python Signature theme={null}
getLatestMessage() -> Any
```

Return the most recent message from the subscription queue.

Blocks for up to one second waiting for a message.

**Returns:**

The raw payload bytes of the latest message, or `None` if no
message was received within the timeout.

### `get_image()`

```python Signature theme={null}
get_image() -> Optional[np.ndarray]
```

### `msg_cb()`

```python Signature theme={null}
msg_cb(sample: Any) -> None
```

Handle an incoming Zenoh sample by storing its payload in the queue.

<ParamField body="sample" required>
  The Zenoh sample received from the subscription.
</ParamField>

### `process_latest_msg()`

```python Signature theme={null}
process_latest_msg() -> None
```

Process the latest message from the queue. Override in subclasses.

### `publish()`

```python Signature theme={null}
publish(data: bytes) -> None
```

Publish data to the topic.

<ParamField body="data" required>
  Raw bytes to publish on the configured topic.
</ParamField>

### `publish_image()`

```python Signature theme={null}
publish_image(
    data: np.ndarray,
    encoding: str = 'rgb8',
    compressed: bool = True,
    format: str = 'jpeg',
    quality: int = 85,
) -> None
```

Publish an image to the topic.

<ParamField body="data" required>
  Image data as numpy array
</ParamField>

<ParamField body="encoding" default="'rgb8'">
  Image encoding (e.g., "rgb8", "32FC1")
</ParamField>

<ParamField body="compressed" default="True">
  Whether to use compressed image format (default: True)
</ParamField>

<ParamField body="format" default="'jpeg'">
  Compression format ("jpeg" or "png"), only used if compressed=True
</ParamField>

<ParamField body="quality" default="85">
  JPEG quality (0-100), only used for JPEG compression
</ParamField>

### `run()`

```python Signature theme={null}
run() -> None
```

Start the client by declaring a subscriber or publisher on the session.

### `stop()`

```python Signature theme={null}
stop() -> None
```

Undeclare the subscriber and close the owned Zenoh session if any.


## Related topics

- [GRID Cortex Client](/models/cortex.md)
- [CortexHubClient](/python-api/grid-cortex-client/cortexhubclient.md)
- [RemoteRobot](/python-api/grid-nexus-client/remoterobot.md)
- [connect](/python-api/grid-nexus-client/connect.md)
- [Sensors](/simulation/isaac/sensors.md)
