mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 09:21:09 +02:00
gpt-image-1 answered the last Try-On attempt with invalid_image_file: Invalid image file or mode for image 2 because one of the references (face/body/garment) was in a format or color mode OpenAI's edits endpoint rejects — typical culprits are HEIC from iPhones, CMYK JPEG, palette-mode PNG, APNG, or JPEG with an ICC profile gpt-image-1 doesn't honour. mana-media stores originals verbatim so whatever the user uploaded is what we were forwarding. Route the references through mana-media's existing on-the-fly /transform endpoint (format=png, w/h=1024, fit=inside) which pipes the buffer through sharp server-side. One call per ref, all run in parallel, same latency budget as before. Output is guaranteed - PNG / RGB (or RGBA if the source had alpha, which gpt-image-1 accepts), - no more than 1024 px on the longest side → well under OpenAI's 4 MB/image cap, - aspect-ratio-preserving (fit=inside) so a portrait body photo doesn't get squished into a square. New helper `getMediaBufferAsPng(mediaId, longestSide)` in lib/media.ts encapsulates the transform-URL build. The Try-On path in the picture route now uses it instead of `getMediaBuffer`; all Blob filenames pin to `.png` since the buffer is already normalized. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| articles | ||
| calendar | ||
| chat | ||
| contacts | ||
| context | ||
| food | ||
| guides | ||
| moodlit | ||
| music | ||
| news | ||
| news-research | ||
| picture | ||
| plants | ||
| presi | ||
| profile | ||
| research | ||
| storage | ||
| todo | ||
| traces | ||
| wardrobe | ||
| website | ||
| wetter | ||
| who | ||