# tinker.types.ImageChunk

## _class_ [**tinker.types.ImageChunk**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L12)( _[StrictBase](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/_models.py#L76)_)

**Fields:**

- [**data**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L13) ( _bytes_) – Image data as bytes
- [**format**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L16) ( _Literal\['png', 'jpeg'\]_) – Image format
- [**expected_tokens**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L19) ( _int | None_) – Expected number of tokens this image represents. This is only advisory: the tinker backend will compute the number of tokens from the image, and we can fail requests quickly if the tokens does not match expected_tokens.
- [**type**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L25) ( _Literal\['image'\]_)

### [**validate_data**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L29)( _value_)

Deserialize base64 string to bytes if needed.

**Parameters:**

- [**value**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L29) ( _Union\[bytes, str\]_)

**Returns:** _bytes_

### [**serialize_data**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L36)( _value_)

Serialize bytes to base64 string for JSON.

**Parameters:**

- [**value**](https://github.com/thinking-machines-lab/tinker/blob/main/src/tinker/types/image_chunk.py#L36) ( _bytes_)

**Returns:** _str_
