單張圖像轉動畫精靈表
上傳單張圖像以產生動畫序列。該工作流程會建立包含多個幀的精靈表,用於遊戲或動畫中。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview執行於
- 輸出
- 圖片
- 作者
- Purz
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"2": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/spritesheet_output",
"images": [
"98",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"14": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"57": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_01",
"images": [
"93:32",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"58": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_02",
"images": [
"93:45",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"59": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_03",
"images": [
"93:46",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"61": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_04",
"images": [
"93:48",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"64": {
"class_type": "SaveImageWithAlpha",
"inputs": {
"filename_prefix": "sprite_sheet/spritesheet_mask",
"images": [
"93:86",
0
],
"mask": [
"93:86",
1
]
},
"_meta": {
"title": "Save Image With Alpha"
}
},
"74": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_05",
"images": [
"93:70",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"75": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_06",
"images": [
"93:71",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"76": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_07",
"images": [
"93:72",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"77": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "sprite_sheet/frame_08",
"images": [
"93:73",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"82": {
"class_type": "VHS_VideoCombine",
"inputs": {
"dither": "sierra2_4a",
"filename_prefix": "sprite_sheet/animation",
"format": "video/ffmpeg-gif",
"frame_rate": 8,
"images": [
"93:81",
0
],
"loop_count": 0,
"pingpong": False,
"save_output": True
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"87": {
"class_type": "VHS_VideoCombine",
"inputs": {
"filename_prefix": "sprite_sheet/animation",
"format": "image/webp",
"frame_rate": 8,
"images": [
"93:81",
0
],
"loop_count": 0,
"lossless": True,
"pingpong": False,
"save_output": True
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"98": {
"class_type": "GeminiNanoBanana2",
"inputs": {
"aspect_ratio": "16:9",
"images": [
"14",
0
],
"model": "Nano Banana 2 (Gemini 3.1 Flash Image)",
"prompt": "pixelart, 32x32 pixels sprite sheet, white background, 4 x 2 grid of images\n\na cheerful jump-and-wave animation cycle for this character, eight frames read left to right and top to bottom: crouching low to gather energy, springing upward with both arms stretched high, reaching the top of the jump with a big open-mouthed smile, waving one paw at the viewer while floating, starting to fall with fur fluffing upward, landing softly with knees bent, bouncing back up to standing, and settling into a happy idle pose. Same character, same colours, same scale and same position in every cell, crisp pixel edges, no text.",
"resolution": "2K",
"response_modalities": "IMAGE",
"seed": 804086386519426,
"system_prompt": "You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests.",
"thinking_level": "HIGH"
},
"_meta": {
"title": "Nano Banana 2"
}
},
"93:32": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:41",
0
],
"image": [
"93:86",
0
],
"left": 0,
"right": [
"93:33",
0
],
"top": 0
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:33": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"93:34",
0
],
"b": 0,
"value": "a / 4"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"93:34": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"98",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"93:37": {
"class_type": "SplitImageWithAlpha",
"inputs": {
"image": [
"98",
0
]
},
"_meta": {
"title": "Split Image with Alpha"
}
},
"93:38": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"93:33",
0
],
"b": [
"93:33",
0
],
"value": "a + b"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"93:39": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"93:38",
0
],
"b": [
"93:33",
0
],
"value": "a + b"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"93:41": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"93:34",
1
],
"b": 0,
"value": "a / 2"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"93:45": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:41",
0
],
"image": [
"93:86",
0
],
"left": [
"93:33",
0
],
"right": [
"93:38",
0
],
"top": 0
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:46": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:41",
0
],
"image": [
"93:86",
0
],
"left": [
"93:38",
0
],
"right": [
"93:39",
0
],
"top": 0
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:48": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:41",
0
],
"image": [
"93:86",
0
],
"left": [
"93:39",
0
],
"right": [
"93:53",
0
],
"top": 0
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:53": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"93:39",
0
],
"b": [
"93:33",
0
],
"value": "a + b"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"93:65": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"93:33",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"93:66": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"93:38",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"93:67": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"93:39",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"93:68": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"93:53",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"93:70": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:34",
1
],
"image": [
"93:86",
0
],
"left": 0,
"right": [
"93:33",
0
],
"top": [
"93:41",
0
]
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:71": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:34",
1
],
"image": [
"93:86",
0
],
"left": [
"93:33",
0
],
"right": [
"93:38",
0
],
"top": [
"93:41",
0
]
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:72": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:34",
1
],
"image": [
"93:86",
0
],
"left": [
"93:38",
0
],
"right": [
"93:39",
0
],
"top": [
"93:41",
0
]
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:73": {
"class_type": "Image Crop Location",
"inputs": {
"bottom": [
"93:34",
1
],
"image": [
"93:86",
0
],
"left": [
"93:39",
0
],
"right": [
"93:53",
0
],
"top": [
"93:41",
0
]
},
"_meta": {
"title": "Image Crop Location"
}
},
"93:81": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"93:32",
0
],
"images.image1": [
"93:45",
0
],
"images.image2": [
"93:46",
0
],
"images.image3": [
"93:48",
0
],
"images.image4": [
"93:70",
0
],
"images.image5": [
"93:71",
0
],
"images.image6": [
"93:72",
0
],
"images.image7": [
"93:73",
0
]
},
"_meta": {
"title": "Batch Images"
}
},
"93:86": {
"class_type": "BiRefNetRMBG",
"inputs": {
"background": "Alpha",
"background_color": "#222222",
"image": [
"93:37",
0
],
"invert_output": False,
"mask_blur": 0,
"mask_offset": -4,
"model": "BiRefNet_toonout",
"refine_foreground": False
},
"_meta": {
"title": "BiRefNet (RMBG)"
}
}
})
workflow.set_input("14", "image", client.assets.from_url("https://comfy.org/catalog-media/13770c7a-be67-46ba-99a9-780ff44cf0c8/5594c7b2-396e-4557-8e48-3d0ce775da7e"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("2"):
output.to_file(output.name)
for output in job.get_outputs("87"):
output.to_file(output.name)
for output in job.get_outputs("82"):
output.to_file(output.name)
for output in job.get_outputs("64"):
output.to_file(output.name)
for output in job.get_outputs("57"):
output.to_file(output.name)
for output in job.get_outputs("58"):
output.to_file(output.name)
for output in job.get_outputs("59"):
output.to_file(output.name)
for output in job.get_outputs("61"):
output.to_file(output.name)
for output in job.get_outputs("74"):
output.to_file(output.name)
for output in job.get_outputs("75"):
output.to_file(output.name)
for output in job.get_outputs("76"):
output.to_file(output.name)
for output in job.get_outputs("77"):
output.to_file(output.name)試試範例
關於此工作流程
This ComfyUI workflow, titled 'Single Image to Animated Sprite Sheet,' transforms a single static image into a dynamic animated sprite sheet. Utilizing the Nano Banana 2 model, the workflow leverages advanced AI capabilities to interpret and animate the image based on user-defined prompts. Key nodes such as SaveImage, LoadImage, and VHS_VideoCombine work in conjunction to create a seamless animation sequence.
The workflow also incorporates custom nodes like comfyui-kjnodes and comfyui-rmbg to enhance the animation process by removing backgrounds and combining video frames efficiently. This workflow is particularly useful for game developers and animators looking to quickly generate animated assets from static images.
問答
以高解析度、主體清楚、背景雜訊少的圖片效果最好,能確保動畫更準確且更平滑。
可以。你可以在提示詞框中指定影格數以及動畫類型,以符合你的需求。
可以。工作流程包含使用 comfyui-rmbg 節點的去背能力,能輸出乾淨的透明背景。
你可以使用 SaveImageWithAlpha 節點將精靈表儲存為多種格式,包括 GIF 與 WebM。