diff --git a/docs/nanobanana-skill.md b/docs/nanobanana-skill.md index f657d36..f44264f 100644 --- a/docs/nanobanana-skill.md +++ b/docs/nanobanana-skill.md @@ -71,11 +71,22 @@ metadata: ## BSN-Use-Cases +### ⚡ Standard-Format für ALLE BSN-Bilder + +| Parameter | Wert | +|---|---| +| Auflösung | 1920 × 1080 px | +| DPI | 72 (Web-Standard) | +| Format | JPG | +| API-Mapping | `resolution: "2K"` + `aspectRatio: "16:9"` | + +> **Wichtig:** Die API garantiert keine exakten Pixelmaße. Mit `2K + 16:9` kommt ca. 1920×1080 heraus. Bei Abweichungen → Post-Processing mit Pillow (s.u.). + ### 1. Artikel-Header-Bild aus Prompt ```bash curl -s -X POST "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-2" \ - -H "Authorization: Bearer $(bsn-secrets get bsn/nanobanana-key)" \ + -H "Authorization: Bearer *** get bsn/nanobanana-key)" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Professional board game photography of Catan, hexagonal tiles, wooden pieces, warm lighting, 4K product shot style", @@ -90,18 +101,32 @@ curl -s -X POST "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-2" \ ```bash curl -s -X POST "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-2" \ - -H "Authorization: Bearer $(bsn-secrets get bsn/nanobanana-key)" \ + -H "Authorization: Bearer *** get bsn/nanobanana-key)" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Transform this board game cover into a cinematic movie poster style, dramatic lighting, epic composition, keep the game title and theme", "imageUrls": ["https://example.com/catan-cover.jpg"], - "aspectRatio": "2:3", + "aspectRatio": "16:9", "resolution": "2K", "outputFormat": "jpg" }' ``` -### 3. Polling bis zum Ergebnis (Python) +### 3. Post-Processing: Exakt 1920×1080 + 72 DPI + +```python +from PIL import Image + +def normalize_bsn_image(path: str) -> str: + """Bringt Bild auf exakt 1920×1080, 72 DPI, JPG.""" + img = Image.open(path) + img = img.convert("RGB") # Falls PNG/RGBA + img = img.resize((1920, 1080), Image.LANCZOS) + img.save(path, "JPEG", quality=92, dpi=(72, 72)) + return path +``` + +### 4. Polling bis zum Ergebnis (Python) ```python import time, requests, json @@ -142,13 +167,13 @@ raise TimeoutError("Timeout after 5 minutes") - `"Transform this board game cover into a [STIL] style poster, keep title and key art elements"` ### Aspect-Ratio-Guide: -| Zweck | Ratio | -|---|---| -| Header-Bild (News) | 16:9 | -| Thumbnail | 1:1 | -| Instagram/Story | 9:16 | -| Cover-Reproduktion | 2:3 (Standard-Brettspiel-Box) | -| Breitformat-Banner | 21:9 | +| Zweck | Ratio | Entspricht | +|---|---|---| +| **Header-Bild (News)** ⭐ | **16:9** | **1920×1080 px** | +| Thumbnail | 1:1 | Quadratisch | +| Instagram/Story | 9:16 | Hochformat | +| Cover-Reproduktion | 2:3 | Standard-Brettspiel-Box | +| Breitformat-Banner | 21:9 | Ultrawide ### Styles für Brettspiel-Bilder: - `product shot style` — clean, wie Amazon-Produktbilder @@ -188,3 +213,5 @@ curl -s "https://api.nanobananaapi.ai/api/v1/common/account-credits" \ - **Prompt-Länge max 20K** bei generate-2, weniger bei generate - **Aspect-Ratio als String** `"16:9"` — nicht als Float - **Status-Check:** Immer `r["data"]["status"]` prüfen — nicht `r["code"]` +- **Keine exakten Pixel-Garantien** — API liefert ~1920×1080 bei 2K+16:9. Immer mit `normalize_bsn_image()` nachbearbeiten für exakte 1920×1080 @ 72 DPI +- **DPI wird von API nicht gesetzt** — JPGs aus der API haben oft keine DPI-Metadaten. `PIL.Image.save(dpi=(72,72))` behebt das