Game Image Asset Pipeline
Use this skill to turn generated images into clean game assets quickly and repeatedly.
1) Lock Target Asset Spec
Before running any script, confirm:
- Output size (for example
256x256,512x512) - Output format (
PNGwith alpha) - Framing rule (tight crop vs extra padding)
- Whether watermark/logo cleanup is required
Only run watermark removal on images you are allowed to modify.
2) Run Baseline Pipeline
Use:
python3 scripts/build_icon.py INPUT_IMAGE OUTPUT_IMAGE \
--size 256 \
--watermark-corners br
Default behavior:
- Estimate plain background color from border pixels
- Remove connected background region
- Remove bright low-saturation corner watermark components
- Crop to remaining non-transparent subject
- Resize and center to square transparent canvas
3) Tune Parameters When Needed
Use these first-line adjustments:
- Increase
--bg-thresholdwhen background residue remains - Decrease
--bg-thresholdwhen foreground edges are cut - Increase
--wm-value-thresholdto remove fewer bright regions - Increase
--wm-sat-thresholdto remove more grayscale watermark pixels - Change
--watermark-corners(tl,tr,bl,br,all,none) based on watermark position - Use
--paddingto control empty margin in final icon
If watermark overlaps the character itself, do not over-clean with thresholds; keep the script conservative and perform manual retouch for that region.
4) Validate Output
After generation, verify:
- Output size matches spec exactly
- Transparent background has no halo in game UI
- Watermark is gone or below visibility threshold
- Subject is centered and not clipped
Resource Map
scripts/build_icon.py: end-to-end icon conversion script (Pillow only).references/parameter-tuning.md: parameter decision guide and scenario presets.