INNER CODE UNIT · Python

get_slot_mask_image

GenielabsOpenSource/spine-animation-ai · reskin-app/app/backend/server.py:252

def get_slot_mask_image(skin_name: str, slot: str):
    project = _State.require_project()
    f = project.workdir / "skins" / skin_name / "masks" / f"{slot}.png"
    if not f.exists():
        raise HTTPException(404, "no mask")
    return FileResponse(f)


@app.put("/api/skin/{skin_name}/mask-image/{slot}")
async def put_slot_mask_image(skin_name: str, slot: str, request: Request):
    """Save a binary mask PNG (8-bit greyscale) for a slot, then re-pack."""
    project = _State.require_project()
    body = await request.body()
    if not body:
        raise HTTPException(400, "empty body")
    masks_dir = project.workdir / "skins" / skin_name / "masks"
    masks_dir.mkdir(parents=True, exist_ok=True)
    mask_file = masks_dir / f"{slot}.png"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…