自动扩缩edit图片的大小适应gptimage2的生成图片大小参数要求 #82
Reference in New Issue
Block a user
Delete Branch "gptimage2-param-limit-in-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
尺寸严格限制规则 (Strict Size Constraints):
图片最大边长 ≤ 3840px <- by hardcoded length
宽高两边像素均为 16px 的倍数 <- by backend do crop
长边 / 短边 比值 ≤ 3:1 <- by hardcoded aspect ratio
总像素范围:最小 655360 ~ 最大 8294400 <- by auto scale in this pr
logic impl in the backend
Adjust image generation size logic for model constraintsto 自动扩缩edit图片的大小适应gptimage2的生成图片大小参数要求[P1] 宣发素材固定尺寸被改写,违反现有契约。
editor_project.rs (line 1879) 对 publication-material 的显式 size 也套了 clamp,测试还把 720x540 改成 935x702。但文档明确要求游戏首图 720x540、详情图 720x1280、运营海报 1280x720,明确像素值要原样透传,见 宣发素材设计文档 (line 57)。这会改变产物业务规格,不只是 provider 参数。
[P1] 极端比例仍会生成非法 provider 尺寸。
editor_project.rs (line 1888) 仍接受每边 64..=4096 的自定义尺寸,但 clamp (line 1917) 只按总像素缩放,不重查最大边长和 3:1。比如 64x4096 会被放大到约 102x6477,高度和比例都更不合法。
[P1] 16 倍数没有统一兜住。
新 clamp 会产出 810x810、935x702 这类非 16 倍数。普通 generation 路径会直接把 image_size 传给 provider;只有独立 edit 路径后面会再做 16 对齐。相关位置在 editor_project.rs (line 1556) 和 editor_project.rs (line 2167)。
[P2] 格式检查不干净。
单文件 rustfmt --check 会报本 PR 新增/改动的 editor_project.rs 长行和空行问题;git diff --check 倒是通过。