diff --git a/article_server.py b/article_server.py index bc5e725..9d61d04 100644 --- a/article_server.py +++ b/article_server.py @@ -1147,7 +1147,8 @@ h1{color:#c0392b;}p{color:#888;} if 'name="prompt"' in headers_raw: prompt = content.decode("utf-8", errors="ignore") elif 'name="aspectRatio"' in headers_raw: - aspect_ratio = content.decode("utf-8", errors="ignore") + # Ignoriert — wird auf "16:9" erzwungen (Daniels Vorgabe) + pass elif 'name="resolution"' in headers_raw: resolution = content.decode("utf-8", errors="ignore") elif 'name="image"' in headers_raw and len(content) > 100: @@ -1183,40 +1184,13 @@ h1{color:#c0392b;}p{color:#888;} with open(filepath, "wb") as f: f.write(img_bytes) - # Optional: PIL-Konvertierung zu JPEG (aspect-ratio-bewusst) + # PNG → JPEG konvertieren (nur Format + DPI, KEINE Größenänderung!) try: from PIL import Image - - # Zielauflösung aus Aspect-Ratio berechnen - def _aspect_to_size(ratio_str: str, base: int = 1920) -> tuple[int, int]: - """Aspect-Ratio-String in Ziel-Pixelmaße umrechnen.""" - mapping = { - "16:9": (1920, 1080), - "1:1": (1080, 1080), - "2:3": (720, 1080), - "3:2": (1620, 1080), - "3:4": (810, 1080), - "4:3": (1440, 1080), - "4:5": (864, 1080), - "5:4": (1350, 1080), - "9:16": (607, 1080), - "21:9": (1920, 823), - } - # Fallback: selbst parsen - try: - w, h = ratio_str.split(":") - w_ratio, h_ratio = int(w), int(h) - # Immer Höhe = 1080, Breite proportional - width = int(1080 * w_ratio / h_ratio) - return mapping.get(ratio_str, (width, 1080)) - except (ValueError, ZeroDivisionError): - return (1920, 1080) - - target_w, target_h = _aspect_to_size(aspect_ratio) img = Image.open(filepath) img = img.convert("RGB") - img = img.resize((target_w, target_h), Image.LANCZOS) jpg_path = os.path.join(month_dir, base_name + ".jpg") + # Original-Abmessungen beibehalten, nur DPI setzen img.save(jpg_path, "JPEG", dpi=(72, 72), quality=92) filepath = jpg_path ext = ".jpg" @@ -2134,13 +2108,7 @@ textarea:focus, select:focus {{ border-color: var(--bsn-blue); outline: none; bo
- +
16:9 — Full HD (fix)
@@ -2261,7 +2229,7 @@ async function startGeneration() {{ try {{ const formData = new FormData(); formData.append('prompt', prompt); - formData.append('aspectRatio', document.getElementById('aspectRatio').value); + formData.append('aspectRatio', '16:9'); // Fix: immer 16:9 (Daniels Vorgabe) formData.append('resolution', document.getElementById('resolution').value); if (uploadedImageData) {{ formData.append('image', uploadedImageData);