feat: 接口2/5 发际线叠图改为透明 PNG(仅曲线),生发图不变
接口2(/api/v1/hair/grow)的 image_url 和接口5(/api/v1/hairline/generate) 的 image_middle/high/low_url 从「原图+白线合成 JPG」改为「透明底 PNG(仅含 发际线曲线)」,前端需叠加原图显示。grown_image_url 生发图保持不变(ComfyUI 完整人像照片)。 实现: - app.py 新增 _rgba_png_b64() 编码 RGBA 透明层为 PNG base64(保留 alpha) - hairline/service.py 接口2/5 改用 build_overlay_layer(返回 RGBA 透明层) 替代 render_hairline_overlay(合成到原图) - 网关零改动:rewrite_base64_to_url 已按 \x89PNG 魔数嗅探落盘为 .png 测试页:test_interface2/5.html 改为「原图打底 + 透明PNG 绝对定位叠加」显示 (复用 .img-stack 结构,固定叠加无开关)。 文档:接口文档.md / integration.html 更新接口2/5 图片字段说明。 测试:43 passed,接口2 image_base64 改断言为 PNG 魔数,接口5 三档叠图同。
This commit is contained in:
@@ -59,6 +59,10 @@
|
||||
.scheme-imgs .img-slot .thumb { background: #222; border-radius: 6px; overflow: hidden; line-height: 0; }
|
||||
.scheme-imgs .img-slot .thumb img { width: 100%; max-height: 220px; object-fit: contain; display: block; }
|
||||
.scheme-imgs .img-slot .na { color: #d1d5db; font-size: 12px; padding: 30px 0; background: #f9fafb; border-radius: 6px; }
|
||||
/* 原图 + 透明 PNG 叠加显示 */
|
||||
.img-stack { position: relative; display: inline-block; line-height: 0; }
|
||||
.img-stack .layer-base { display: block; width: 100%; max-height: 220px; object-fit: contain; }
|
||||
.img-stack .layer-anno { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; }
|
||||
|
||||
.json-panel { max-height: 550px; overflow: auto; }
|
||||
.json-content { padding: 14px 16px; font-family: "SF Mono", "Fira Code", monospace; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
|
||||
@@ -181,10 +185,13 @@ function renderSchemes(results) {
|
||||
'<div class="label">📷 原图</div>'+
|
||||
'<div class="thumb"><img src="'+_origUrl+'" alt="原图"></div></div>';
|
||||
|
||||
// 发际线叠加
|
||||
// 发际线叠加(原图 + 透明 PNG 叠加显示)
|
||||
const overlaySlot = '<div class="img-slot">'+
|
||||
'<div class="label"><span class="dot preview"></span>发际线叠加</div>'+
|
||||
'<div class="thumb"><img src="'+r.image_url+'" alt="叠加"></div></div>';
|
||||
'<div class="label"><span class="dot preview"></span>原图+发际线叠加</div>'+
|
||||
'<div class="thumb"><div class="img-stack">'+
|
||||
'<img class="layer-base" src="'+_origUrl+'" alt="原图">'+
|
||||
'<img class="layer-anno" src="'+r.image_url+'" alt="叠加">'+
|
||||
'</div></div></div>';
|
||||
|
||||
// 生发效果
|
||||
let grownSlot;
|
||||
|
||||
Reference in New Issue
Block a user