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

# read_images

> Read image files as a SQL table, one row per image.

`read_images` reads image files and returns one row per image. Each row has the encoded bytes in `image`, plus the format, dimensions, and file size.

## Signature

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
read_images(pattern)
```

| Parameter | Type | Description |
| - | - | - |
| `pattern` | `VARCHAR` | An image file, directory, glob, or supported remote URI. |

Supported extensions: `.jpg`, `.jpeg`, `.png`, `.webp`, `.gif`, `.bmp`, `.tif`, and `.tiff`.

## Example

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    format,
    width,
    height,
    size_bytes
FROM read_images('hf://buckets/chowderai/chowder-demo/image/data/amazon-products/drinking-cup/*.jpg')
LIMIT 5;
```

## Columns

| Column | Type | Description |
| - | - | - |
| `source` | `VARCHAR` | Input path or URI. |
| `image` | `BINARY` | Original encoded image bytes. |
| `format` | `VARCHAR` | Image format from the file header, such as `jpeg` or `png`. |
| `width` | `INT` | Pixel width. |
| `height` | `INT` | Pixel height. |
| `size_bytes` | `BIGINT` | File size in bytes. |
| `metadata` | `STRUCT<error VARCHAR>` | `error`: why the file couldn't be read or its header parsed. Null otherwise. |

A file whose header can't be read still returns a row, with its bytes and an error in `metadata`. Files larger than `CHOWDER_MAX_FILE_MB` (500 MB by default) are skipped with a warning and produce no rows. A remote server can set its own limit. See [Configuration](https://docs.chowder.ai/reference/configuration.md).

## Use images with `infer` and `embed`

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    infer(
        image,
        'Does this cup have a handle?',
        BOOL
    ).output AS has_handle
FROM read_images('hf://buckets/chowderai/chowder-demo/image/data/amazon-products/drinking-cup/*.jpg')
LIMIT 3;
```

## Execution

* Queries that select only `source` and `size_bytes`, including `count(*)`, list files without reading them.
* `size_bytes` filters skip files before they're read.
* `format`, `width`, and `height` come from the image header, without decoding pixels.
* `LIMIT` stops reading files once the query has enough rows.


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