> ## 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.

```ts theme={null}
const result = await RunAnywhere.images.generate('A lighthouse at dusk, oil painting', {
  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.

```ts theme={null}
for await (const event of RunAnywhere.images.generateStream('A lighthouse at dusk', {
  steps: 20,
  reportPartials: true,
})) {
  if (event.type === 'partial') setPreview(event.image)
  if (event.type === 'completed') setFinal(event.result)
}
```

## 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, and a phone feels it. A 512×512 image at 20
steps takes far longer than a text completion, drains battery, and warms the device
noticeably. Run one at a time, show progress, allow cancellation, and never put it on a timer.

Keep the screen awake while it runs, or the OS will throttle you partway through.

## Availability

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. Note that `capabilities()` on React Native is a static
literal, so check the model catalog rather than trusting it here.
