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

# Image Generation

> Generate images on-device

`RunAnywhere.images` generates an image from a prompt.

```kotlin theme={null}
val result = RunAnywhere.images.generate(
    "A lighthouse at dusk, oil painting",
    ImageOptions(
        negativePrompt = "blurry, text, watermark",
        width = 512,
        height = 512,
        steps = 20,
        seed = 42
    )
)
```

## Options

| Field            | Default       | Meaning                                            |
| ---------------- | ------------- | -------------------------------------------------- |
| `negativePrompt` | none          | What to avoid                                      |
| `width`          | model default | Output width                                       |
| `height`         | model default | Output height                                      |
| `steps`          | model default | Denoising steps; more is slower and usually better |
| `guidanceScale`  | model default | How closely to follow the prompt                   |
| `seed`           | random        | Fix it to reproduce an image                       |
| `mode`           | generate      | Generate or inpaint                                |
| `reportPartials` | `false`       | Emit intermediate images while streaming           |

## Watching it appear

With `reportPartials` on, the stream emits intermediate images, so you can show the picture
resolving rather than a spinner.

```kotlin theme={null}
RunAnywhere.images.generateStream(
    "A lighthouse at dusk",
    ImageOptions(steps = 20, reportPartials = true)
).collect { event ->
    when (event) {
        is ImageEvent.Partial -> preview = event.image
        is ImageEvent.Completed -> final = event.result
        else -> {}
    }
}
```

## Reproducing an image

Fix the seed and every other option, and the same prompt produces the same image. Without a
fixed seed, it will not.

## Cost

Image generation is the heaviest thing in the SDK. A 512×512 image at 20 steps takes far longer
than a text completion and warms the device noticeably. Run one at a time, show progress, allow
cancellation, and do not put it on a timer.

## Availability

Check before offering it:

```kotlin theme={null}
val capabilities = RunAnywhere.capabilities()
```

A diffusion model has to be registered and a backend has to serve it. The namespace existing
does not mean the catalog has an entry.
