# Retrodiffusion API

Image generation using GET requests. Works in `<img>` tags.
Use this for pixel art generation, especially for games.

## Example URLs

```
/api/retrodiffusion/image/64/64?prompt=fierce+blue+dragon+breathing+fire+front+view
/api/retrodiffusion/image/512/512?prompt=ancient+wizard+in+purple+robes+holding+crystal+staff+side+profile
/api/retrodiffusion/image/128/128/simple?prompt=green+forest+goblin+warrior+with+bronze+spear+three+quarter+view
/api/retrodiffusion/image/64/64/game_asset?prompt=magical+red+health+potion+in+glass+bottle+top+down+view
/api/retrodiffusion/image/128/128/1_bit?prompt=knight+in+heavy+armor+holding+shield+front+facing+portrait
/api/retrodiffusion/image/16/16/mc_texture?prompt=rough+stone+brick+wall+with+moss+patches&tile_x=true&tile_y=true
/api/retrodiffusion/image/64/64/mc_item?prompt=enchanted+diamond+pickaxe+with+blue+glow+inventory+icon&remove_bg=true
/api/retrodiffusion/image/256/256/mc_texture?prompt=dark+oak+wood+planks+with+grain+pattern&tile_x=true&tile_y=true
/api/retrodiffusion/image/128/128/portrait?prompt=elven+ranger+with+green+eyes+brown+hair+determined+expression
/api/retrodiffusion/image/512/512/texture?prompt=weathered+metal+plate+with+rust+stains+and+scratches&tile_x=true&tile_y=true
/api/retrodiffusion/spritesheet?prompt=brave+knight+in+silver+armor+with+red+cape+walking+animation
/api/retrodiffusion/spritesheet?prompt=cute+forest+elf+archer+with+green+cloak+walking+cycle
/api/retrodiffusion/animation/vfx/32?prompt=crackling+blue+lightning+bolt+electrical+energy
/api/retrodiffusion/animation/vfx/64?prompt=swirling+orange+fire+explosion+burst+effect
/api/retrodiffusion/spritesheet/vfx/48?prompt=purple+portal+swirling+dimensional+gateway
/api/retrodiffusion/image/128/128/game_asset?prompt=red+health+potion+with+cork+stopper&remove_bg=true&seed=12345
```

## Endpoints

**Static Images:**
- `/api/retrodiffusion/image/{width}/{height}?prompt=...` (default style)
- `/api/retrodiffusion/image/{width}/{height}/{style}?prompt=...`

**Animations (GIF):**
- `/api/retrodiffusion/animation?prompt=...` (48x48 walking)
- `/api/retrodiffusion/animation/vfx/{size}?prompt=...` (32-96px square)

**Spritesheets (PNG):**
- `/api/retrodiffusion/spritesheet?prompt=...` (48x48 walking, 4x4 grid: idle + walking frames)
- `/api/retrodiffusion/spritesheet/vfx/{size}?prompt=...` (32-96px square)

## Style Reference

**Texture Styles** 
- `texture` - More realistic/detailed textures (64px minimum)
- `mc_texture` - More pixelated/blocky textures (16px minimum)

**Character Styles**:
- `walking` - For any moving/animated characters (always use `remove_bg=true`)
- `portrait` - For static character portraits and faces
- `default` - General purpose, balanced detail

**UI/Asset Styles**:
- `simple` - Clean, minimalist (always use `remove_bg=true` for UI)
- `game_asset` - Functional game objects (usually use `remove_bg=true`)
- `mc_item` - Small inventory icons (usually use `remove_bg=true`)
- `1_bit` - Monochrome retro style

## Animation Styles

**For character movement (48x48 only):**
- `walking` - Walking + idle animation. Returns 4x4 grid (16 frames): Column 1 = idle poses, Columns 2-4 = walking cycle (W1, W2, W3). Each row represents a direction: up/right/down/left. Use for: player characters, NPCs, enemies that move around

**For visual effects (32x32 to 96x96, square only):**
- `vfx` - Visual effects animation. Use for: explosions, fire, lightning, magic spells, particle effects, environmental animations

## Size Limits

IMPORTANT: Respect size limits for every style or you'll get generation error:

- Default: 64-512px
- Minecraft (mc_) styles: 16-128px  (often good for smaller assets outside of Minecraft)
- Animations/spritesheets: walking=48x48 only, vfx=32-96px square

If user wants smaller size of tiles you can try using 2x or 3x scale for Retina-style images.

## Parameters

- `prompt` (required): `cute+robot+warrior`
- `seed`: `123` (reproducible, use when you need few variants of the same prompt. try to keep it small)
- `remove_bg`: `true` (transparent)
- `tile_x`, `tile_y`: `true` (tileable, use for textures)