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

> ## Agent Instructions
> TabPFN-3 and later versions support up to 1,000,000 rows, subject to feature count and checkpoint/API limits.
> For large datasets, use per-estimator subsampling, e.g. inference_config={"SUBSAMPLE_SAMPLES": 100_000}, in TabPFNClassifier or TabPFNRegressor from tabpfn or tabpfn_client.
> Pass raw pandas DataFrames to fit and predict. Categorical strings/categories, raw text, and missing feature values are handled automatically; no manual integer/one-hot encoding, imputation, scaling, or outlier removal is needed.

# Image transformer

> Replaces each declared image column of a DataFrame by numeric features.

## `ImageTransformer`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/image_transformer.py#L35)

Replaces each declared image column of a DataFrame by numeric features.

```python theme={null}
ImageTransformer(
    image_features_indices: Sequence[int],
    *,
    n_components: int = DEFAULT_N_COMPONENTS,
    device: Any = "auto",
    batch_size: int = DEFAULT_BATCH_SIZE,
)
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `image_features_indices` | `Sequence[int]` | Required | Positions of the image columns in `X`. Such a column holds one image per cell, as a base64 string, the image file's path or bytes, or a PIL image, so its dtype is object or string. |
| `n_components` | `int` | `DEFAULT_N_COMPONENTS` | Features an image column is expanded into. |
| `device` | `Any` | `"auto"` | Where the encoder runs, as TabPFN's `device` argument. |
| `batch_size` | `int` | `DEFAULT_BATCH_SIZE` | Images per encoder forward pass. |

**Attributes**

| Attribute | Type | Description |
| - | - | - |
| `reducers_` | `dict[int, Pipeline]` | Input position -> the column's fitted scaler and PCA. |
| `feature_names_in_` | `np.ndarray` | Labels of the frame [`fit`](https://docs.priorlabs.ai/api-reference/python/tabpfn-extensions/image/transformer#image-image-transformer-imagetransformer-fit) saw, as strings. |

***

## `ImageTransformer.fit`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/image_transformer.py#L68)

Fit one scaler and PCA per declared column; `y` is ignored.

```python theme={null}
ImageTransformer.fit(
    X: pd.DataFrame,
    y: Any = None,
) -> ImageTransformer
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame` | Required | — |
| `y` | `Any` | `None` | — |

**Returns**

| Type | Description |
| - | - |
| `ImageTransformer` | — |

***

## `ImageTransformer.fit_transform`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/image_transformer.py#L73)

Fit every declared column and return the expanded frame.

```python theme={null}
ImageTransformer.fit_transform(
    X: pd.DataFrame,
    y: Any = None,
    **fit_params: Any,
) -> pd.DataFrame
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame` | Required | — |
| `y` | `Any` | `None` | — |
| `**fit_params` | `Any` | — | — |

**Returns**

| Type | Description |
| - | - |
| `pd.DataFrame` | — |

***

## `ImageTransformer.get_feature_names_out`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/image_transformer.py#L109)

The kept columns' labels, then the image features', as an object array.

```python theme={null}
ImageTransformer.get_feature_names_out(
    input_features: Any = None,
) -> np.ndarray
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `input_features` | `Any` | `None` | — |

**Returns**

| Type | Description |
| - | - |
| `np.ndarray` | — |

***

## `ImageTransformer.output_indices`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/image_transformer.py#L118)

Where the input positions `indices` sit once the image columns moved.

```python theme={null}
ImageTransformer.output_indices(
    indices: Sequence[int] | None,
    *,
    n_columns: int,
) -> list[int] | None
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `indices` | `Sequence[int] \| None` | Required | Positions in a frame of `n_columns` columns; `None` stays `None`. |
| `n_columns` | `int` | Required | The width of that frame. |

**Raises**

`ValueError`

If one of them is a declared image column.

**Returns**

| Type | Description |
| - | - |
| `list[int] \| None` | — |

***

## `ImageTransformer.transform`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/image_transformer.py#L98)

Replace the declared columns of `X` by the features fit at training.

```python theme={null}
ImageTransformer.transform(
    X: pd.DataFrame,
) -> pd.DataFrame
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame` | Required | — |

**Returns**

| Type | Description |
| - | - |
| `pd.DataFrame` | — |

***

## `GatedEncoderError`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/_embeddings.py#L34)

The encoder's weights are gated on the Hub and this process may not read them.

```python theme={null}
GatedEncoderError()
```

***

## `image_to_bytes`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/image/_preprocessing.py#L81)

A PIL image encoded as an image file, the form a DataFrame cell takes.

```python theme={null}
image_to_bytes(
    image: Image,
    format: str = "PNG",
) -> bytes
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `image` | `Image` | Required | — |
| `format` | `str` | `"PNG"` | — |

**Returns**

| Type | Description |
| - | - |
| `bytes` | — |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.