Single Image to Animated Sprite Sheet
Upload a single image to generate an animated sequence. The workflow creates a sprite sheet with multiple frames for use in games or animations.
ワークフローの内部
ソーステンプレートの読み取り専用プレビューです。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.
よくある質問
High-resolution images with clear subjects and minimal background noise work best to ensure accurate and smooth animation.
Yes, you can specify the number of frames and the type of animation in the prompt box to tailor the output to your needs.
Yes, the workflow includes background removal capabilities using the comfyui-rmbg node, ensuring a clean, transparent output.
The sprite sheet can be saved in multiple formats, including GIF and WebM, using the SaveImageWithAlpha node.