docs: NanoBanana Skill — 1920×1080 @ 72 DPI Standard + Post-Processing
Quality Gate / 🛡️ Lint + Type Check + Tests (push) Failing after 11m32s
Quality Gate / 🛡️ Lint + Type Check + Tests (push) Failing after 11m32s
This commit is contained in:
+38
-11
@@ -71,11 +71,22 @@ metadata:
|
|||||||
|
|
||||||
## BSN-Use-Cases
|
## 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
|
### 1. Artikel-Header-Bild aus Prompt
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -s -X POST "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-2" \
|
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" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"prompt": "Professional board game photography of Catan, hexagonal tiles, wooden pieces, warm lighting, 4K product shot style",
|
"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
|
```bash
|
||||||
curl -s -X POST "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-2" \
|
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" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"prompt": "Transform this board game cover into a cinematic movie poster style, dramatic lighting, epic composition, keep the game title and theme",
|
"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"],
|
"imageUrls": ["https://example.com/catan-cover.jpg"],
|
||||||
"aspectRatio": "2:3",
|
"aspectRatio": "16:9",
|
||||||
"resolution": "2K",
|
"resolution": "2K",
|
||||||
"outputFormat": "jpg"
|
"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
|
```python
|
||||||
import time, requests, json
|
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"`
|
- `"Transform this board game cover into a [STIL] style poster, keep title and key art elements"`
|
||||||
|
|
||||||
### Aspect-Ratio-Guide:
|
### Aspect-Ratio-Guide:
|
||||||
| Zweck | Ratio |
|
| Zweck | Ratio | Entspricht |
|
||||||
|---|---|
|
|---|---|---|
|
||||||
| Header-Bild (News) | 16:9 |
|
| **Header-Bild (News)** ⭐ | **16:9** | **1920×1080 px** |
|
||||||
| Thumbnail | 1:1 |
|
| Thumbnail | 1:1 | Quadratisch |
|
||||||
| Instagram/Story | 9:16 |
|
| Instagram/Story | 9:16 | Hochformat |
|
||||||
| Cover-Reproduktion | 2:3 (Standard-Brettspiel-Box) |
|
| Cover-Reproduktion | 2:3 | Standard-Brettspiel-Box |
|
||||||
| Breitformat-Banner | 21:9 |
|
| Breitformat-Banner | 21:9 | Ultrawide
|
||||||
|
|
||||||
### Styles für Brettspiel-Bilder:
|
### Styles für Brettspiel-Bilder:
|
||||||
- `product shot style` — clean, wie Amazon-Produktbilder
|
- `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
|
- **Prompt-Länge max 20K** bei generate-2, weniger bei generate
|
||||||
- **Aspect-Ratio als String** `"16:9"` — nicht als Float
|
- **Aspect-Ratio als String** `"16:9"` — nicht als Float
|
||||||
- **Status-Check:** Immer `r["data"]["status"]` prüfen — nicht `r["code"]`
|
- **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
|
||||||
|
|||||||
Reference in New Issue
Block a user