spritecook-polish-sprites
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpriteCook Polish Sprites
SpriteCook 修整精灵
Use with . Inspect completed sprites at their intended size and at a nearest-neighbor zoom before delivery, slicing, or animation. If the outline and transparency already look good, keep them. Use this workflow when edge cleanup could improve the result.
spritecook-workflow-essentials与 配合使用。在交付、切分或制作动画之前,按预期尺寸检查已完成的精灵,并以最近邻缩放方式查看。如果轮廓和透明效果看起来已经很好,就保持不变。当边缘清理能够改善结果时,使用此工作流。
spritecook-workflow-essentialsWhy Outlines Can Look Broken
轮廓为何看起来断裂
Background removal estimates how much each pixel belongs to the subject. Thin outlines, low-contrast edges, hair, handles, and other fine details can receive partial transparency even when they belong to the sprite. Turning that soft alpha into opaque or transparent pixels with a cutoff can discard those edges. Later cleanup such as erosion can also remove pixels.
SpriteCook preserves a pre-alpha-cleanup image for supported assets. A lower cutoff can recover faint outline pixels still present in that source; a higher cutoff can remove halos and background debris. Both Basic and Pro results can benefit from inspection. Pro does not guarantee that every edge survives.
Thresholding cannot reconstruct pixels absent from the preserved source or repair a shape that was generated incorrectly. A processed PNG with only alpha 0 and 255 usually has no recoverable intermediate alpha. Always work from the preserved source, not repeatedly from an already-thresholded preview. Keep intentionally translucent effects translucent unless the user wants hard pixel edges.
If the preserved source itself has only alpha 0 and 255, all positive cutoffs produce the same transparency. That result may still differ from the saved output if later erosion removed pixels, so compare it with the saved image before deciding.
背景移除会判断每个像素在多大程度上属于主体。即使细轮廓、低对比度边缘、头发、把手和其他精细细节属于精灵,也可能会被赋予部分透明度。将这种柔和的 alpha 通过 cutoff 转换为完全不透明或完全透明,可能会丢弃这些边缘。后续的腐蚀(erosion)等清理操作也可能移除像素。
对于受支持的资产,SpriteCook 会保留 Alpha 清理前的图像。较低的 cutoff 可以恢复保留源文件中仍然存在的微弱轮廓像素;较高的 cutoff 可以去除光晕和背景残片。Basic 和 Pro 的结果都可以通过检查得到改善。Pro 并不保证每一条边缘都能保留下来。
阈值处理无法重建保留源文件中已经缺失的像素,也无法修复生成时形状就不正确的问题。只包含 alpha 0 和 255 的已处理 PNG 通常没有可恢复的中间 alpha。始终基于保留源文件操作,不要反复使用已经经过阈值处理的预览图。除非用户需要硬像素边缘,否则应让有意设计的半透明效果继续保持半透明。
如果保留源文件本身也只包含 alpha 0 和 255,那么所有正数 cutoff 都会产生相同的透明结果。不过,如果后续的 erosion 移除了像素,该结果仍可能与已保存的输出不同,因此做出决定前应将其与已保存的图像进行比较。
Inspect Once, Compare Locally, Save Once
检查一次、本地比较、保存一次
-
Calland inspect
get_asset_metadata(asset_id). It reportsalpha_editing,available,current_cutoff,provider,processing, its expiry, and preview/animation layout. If this field orsource_urlis missing, the connected server has not exposed this workflow yet. Do not invent a tool or silently run paid background removal instead.set_asset_alpha_cutoff -
If, explain that the preserved source is unavailable for this asset. A fresh removal pass or a targeted image edit may be needed; follow the user's scope and credit budget. Stop this threshold workflow.
available=false -
For, download
processing="binary_alpha_v1"once using the shared safe-download workflow. Also download the currentsource_urlfor stills orsprite_urlfor animations so the actual saved result can be compared. The URL expires; refresh metadata if necessary. Keep signed URLs out of manifests and committed files.spritesheet_url -
Save the metadata JSON locally and run the bundled helper with Python and Pillow available:text
python scripts/compare_alpha.py --metadata asset.json --source preserved.png --current current.png --output-dir alpha-comparisonResolve the script relative to this skill's directory. Use the project's Python environment where available. Install Pillow into that environment if needed. The helper makes no network calls, spends no credits, and does not modify SpriteCook assets. It outputs, full-size candidate PNGs, andcomparison.png. It starts near the saved cutoff; usecomparison.jsonto choose other candidates. Use a fresh output directory for each comparison.--cutoffs 48 72 96 120 144 -
Inspect the comparison on both light and dark backgrounds, then inspect promising full-size candidates at native size. Look for continuous outlines, preserved fine parts, unwanted bridges between objects, halos, isolated debris, and lost intentional transparency. For animations, inspect every frame for flickering edges. Choose the candidate with the best balance; pixel counts alone cannot judge quality. Compare with the actual saved output, since the original cleanup may also have applied erosion or other processing.
-
If needed, make one more local comparison around the best candidate. Stop when there is a clear improvement or no useful recovery. Do not cycle through paid generation or removal jobs to tune this number.
-
When a candidate improves the result, callonce. It updates the existing asset, saves the cutoff, retains the preserved source, and costs zero credits. Download the returned output and verify it matches the selected candidate. Record the asset ID and selected cutoff in the local asset manifest. If no candidate improves the result, keep the saved asset.
set_asset_alpha_cutoff(asset_id, cutoff)
-
调用并检查
get_asset_metadata(asset_id)。它会报告alpha_editing、available、current_cutoff、provider、processing、URL 的有效期以及预览和动画布局。如果缺少此字段或source_url,说明连接的服务器尚未提供此工作流。不要凭空构造工具,也不要默默改为运行收费的背景移除任务。set_asset_alpha_cutoff -
如果,说明无法获取此资产的保留源文件。可能需要重新执行一次移除流程或进行定向图像编辑;遵守用户指定的范围和 credits 预算。停止此阈值工作流。
available=false -
对于,使用共享的安全下载工作流只下载一次
processing="binary_alpha_v1"。对于静态精灵,还要下载当前的source_url;对于动画,则下载sprite_url,以便比较实际保存的结果。URL 会过期;必要时刷新 metadata。确保不要将签名 URL 写入 manifest 或提交到版本控制文件。spritesheet_url -
在本地保存 metadata JSON,并在已安装 Python 和 Pillow 的环境中运行随附的辅助脚本:text
python scripts/compare_alpha.py --metadata asset.json --source preserved.png --current current.png --output-dir alpha-comparison脚本路径应相对于此 skill 的目录解析。尽可能使用项目的 Python 环境;如确有需要,可在该环境中安装 Pillow。该辅助脚本不会发起网络调用、不会消耗 credits,也不会修改 SpriteCook 资产。它会输出、全尺寸候选 PNG 和comparison.png。它会从接近已保存 cutoff 的值开始;可使用comparison.json选择其他候选值。每次比较都使用新的输出目录。--cutoffs 48 72 96 120 144 -
在浅色和深色背景上检查比较图,然后在原生尺寸下检查表现较好的全尺寸候选图。寻找连续轮廓、保留的精细部件、对象之间不需要的连接、光晕、孤立残片以及丢失的有意透明效果。对于动画,逐帧检查边缘闪烁。选择整体效果最佳的候选;不能只凭像素数量判断质量。将比较结果与实际保存的输出进行对照,因为最初的清理可能还应用了 erosion 或其他处理。
-
如有需要,可围绕最佳候选再做一次本地比较。当效果有明显改善或无法再恢复有用内容时停止。不要反复运行收费的生成或移除任务来调整这个数值。
-
当候选结果有所改善时,调用一次。它会更新现有资产、保存 cutoff、保留源文件,且不消耗 credits。下载返回的输出并确认其与选定候选一致。在本地资产 manifest 中记录资产 ID 和选定 cutoff。如果没有候选能够改善结果,则保留已保存的资产。
set_asset_alpha_cutoff(asset_id, cutoff)
Targeted Outline Repairs
定向轮廓修复
For maximum visual fidelity, make targeted manual or scripted pixel repairs after generation when background removal has left gaps that cutoff tuning cannot fix. Compare with the original image before background removal when available: restore missing outline pixels from it, or reconstruct small, unambiguous gaps using neighboring outline colors and the existing contour. A local image editor or a small script with an explicit repair mask can help. Preserve the sprite's silhouette, outline thickness, palette, and intentional openings; avoid thickening the entire outline or filling every transparent hole automatically.
Inspect the repaired result at native size and nearest-neighbor zoom on light and dark backgrounds. For animations, check that repairs remain consistent across frames without edge flicker. Keep the original and save a separate repaired PNG. saves only threshold changes, not custom pixel edits; use to upload the repaired image when it needs to be reused in SpriteCook, then animate or reference that new asset ID. Record its relationship to the original in the local manifest.
set_asset_alpha_cutoffspritecook-upload-assets若背景移除后留下 cutoff 调优无法修复的缺口,为最大限度提高视觉保真度,应在生成后进行定向的手动或脚本化像素修复。如果原始图像可用,请与移除背景前的原图进行比较:从原图恢复缺失的轮廓像素,或使用相邻轮廓颜色和现有轮廓线重建小而明确的缺口。可以使用本地图像编辑器,或带有明确修复掩码的小型脚本。不要自动加粗整条轮廓或填满每个透明孔洞,应保留精灵的剪影、轮廓粗细、调色板和有意保留的开口。
在原生尺寸和最近邻缩放下,在浅色和深色背景上检查修复结果。对于动画,检查各帧修复是否一致且没有边缘闪烁。保留原文件,并另存为单独的修复 PNG。 只能保存阈值变化,不能保存自定义像素编辑;如需在 SpriteCook 中重复使用修复图像,请使用 上传,然后对该新资产 ID 进行动画制作或引用。在本地 manifest 中记录它与原资产之间的关系。
set_asset_alpha_cutoffspritecook-upload-assetsProcessing Details and Limits
处理细节与限制
- preserves RGB and sets alpha to 255 when source alpha is greater than or equal to the cutoff, otherwise 0. Cutoffs range from 0 to 255. Avoid 0 for ordinary cleanup: it makes even fully transparent pixels opaque.
binary_alpha_v1 - The helper preserves source dimensions and does not resize or crop candidate PNGs. only affects the comparison view. Saving uses the full preserved source, just like the app; check output dimensions before integrating it into a game.
preview_crop - Animation sources use a horizontal PNG spritesheet with the advertised ,
frame_count, andframe_width. Use the same cutoff across frames. The helper rejects mismatched layouts and animated preview files.frame_height - uses background-color tolerance rather than alpha thresholding. The helper intentionally rejects it; use the dedicated tileset edge-cleanup editor instead of treating its cutoff as binary alpha.
tileset_color_tolerance_v1 - Polish a multi-object sheet before slicing when possible. Uploaded or sliced derivatives may lack the original soft-alpha source. Once the sheet looks good, slice it and animate each extracted asset separately using the existing upload and animation skills.
- Local candidates remain local until the save tool is called. Upload a candidate separately only when the user wants an independent copy. A separate upload does not inherit the original asset's editable source.
- 会保留 RGB,并在源 alpha 大于或等于 cutoff 时将其设为 255,否则设为 0。cutoff 范围为 0 到 255。普通清理时应避免使用 0,因为它会让完全透明的像素也变得不透明。
binary_alpha_v1 - 辅助脚本会保留源文件尺寸,不会调整或裁剪候选 PNG。只影响比较视图。保存时使用完整的保留源文件,与应用中的处理方式相同;集成到游戏前请检查输出尺寸。
preview_crop - 动画源文件使用水平排列的 PNG spritesheet,其 、
frame_count和frame_width均为声明值。所有帧使用相同的 cutoff。辅助脚本会拒绝布局不匹配的文件和动画预览文件。frame_height - 使用背景色容差,而不是 Alpha 阈值。辅助脚本会特意拒绝处理它;请使用专用的 tileset 边缘清理编辑器,不要将其 cutoff 当作二值 Alpha 处理。
tileset_color_tolerance_v1 - 尽可能在切分前修整包含多个对象的图集。上传或切分得到的衍生资源可能缺少原始的柔和 alpha 源文件。图集效果良好后,再切分并使用现有上传和动画 skill 分别为每个提取出的资产生成动画。
- 在调用保存工具之前,候选结果会一直保留在本地。只有当用户需要独立副本时,才单独上传候选文件。单独上传的文件不会继承原资产的可编辑源文件。