wip: references

This commit is contained in:
2026-02-24 00:37:51 +07:00
parent 5a854479f9
commit d7fe0e037d
2 changed files with 73 additions and 10 deletions
+12 -5
View File
@@ -17,8 +17,9 @@ pnpm remove-bg -- <file|dir> # Remove white background from PNG icons
Generate images via Banatie API:
```bash
node src/scripts/banatie.mjs --type background --prompt "forest theme" --output assets/backgrounds/forest.png
node src/scripts/banatie.mjs --type icon --prompt "golden star" --output assets/icons/stars/star1.png
node src/scripts/banatie.mjs --prompt "forest theme" --output assets/backgrounds/forest.png --aspect-ratio 9:16
node src/scripts/banatie.mjs --prompt "golden star" --output assets/icons/star.png
node src/scripts/banatie.mjs --prompt "similar gem" --output assets/icons/gem.png --ref assets/icons/sample.png
```
## Directory Structure
@@ -158,11 +159,17 @@ REST API at `https://api.banatie.app` for generating images. Auth via `X-API-Key
- `referenceImages` (string[]) — image IDs as references
- `autoEnhance` (boolean) — prompt enhancement (default: true)
**POST `/api/v1/images/upload`** — upload image (for use as reference):
- Multipart form data, field `file` (up to 5MB, JPEG/PNG/WebP)
- Returns image ID in `data.id`
Response returns JSON with `data.outputImage.storageUrl` (CDN URL to download).
Script `src/scripts/banatie.mjs` wraps the API with presets:
- `background` → `aspectRatio: "9:16"` (vertical, for page backgrounds)
- `icon` → `aspectRatio: "1:1"` (square, for problem card icons)
Script `src/scripts/banatie.mjs` CLI:
```bash
node src/scripts/banatie.mjs --prompt "description" --output path.png [--aspect-ratio 1:1] [--ref file.png]...
```
- `--ref` accepts local file paths (auto-uploaded) or existing image IDs (passed as-is). Can be repeated.
Rate limit: 100 requests/hour per API key.