CoolFace
Apppublic

huensan/sprite-studio

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes
App README

๐ŸŽฎ Sprite Studio

Turn any photo or render into a transparent, game-ready sprite.

  1. 1.Background removal โ€” BiRefNet (MIT) predicts a foreground mask, applied as the alpha channel. Runs on ZeroGPU.
  2. 2.Pixel-art pass (optional, CPU) โ€” area-averaged downscale to the target sprite size, median-cut palette quantization without dithering, and a hard alpha cut-off so edges are on or off rather than half-transparent.

The comparison slider shows the sprite upscaled back to source resolution with nearest-neighbour; the download is the PNG at its true sprite resolution.

Controls

ControlWhat it does
Pixel-art passOff = plain full-resolution cutout
Sprite sizeLongest edge of the output, 8โ€“256 px
Palette coloursMedian-cut quantization target, 2โ€“64
Alpha cut-offThreshold separating transparent from opaque

API / MCP

The Space launches with mcp_server=True, so build_sprite is available both as a Gradio API endpoint and as an MCP tool.

python
from gradio_client import Client, handle_file

client = Client("<namespace>/sprite-studio")
(before_after, png_path) = client.predict(
    image=handle_file("input.png"),
    target_px=64,
    palette_size=16,
    alpha_threshold=128,
    pixel_art=True,
    api_name="/build_sprite",
)