Imagen única a hoja de sprites animada
Sube una sola imagen para generar una secuencia animada. El flujo de trabajo crea una hoja de sprites con múltiples fotogramas para usar en juegos o animaciones.
Dentro del flujo de trabajo
Una vista previa de solo lectura de la plantilla de origen. Ábrela en Cloud para explorar los nodos y hacer cambios.
Loading the graph
Open full-size workflow previewSe ejecuta en
- Salida
- Imagen
- Autor
- Purz
Llama a este modelo desde tu código
La solicitud a continuación utiliza el mismo grafo preparado y la misma configuración que el Playground. Cada envío puede iniciar una ejecución de pago; no reintentes automáticamente un envío cuyo resultado se desconozca.
What you need
- Runs on
- Comfy Cloud
- Clave
- COMFY_API_KEY
- Tus archivos
- El código los sube desde sus URL
Requiere un plan de pago de Cloud y créditos.
# 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)Probar un ejemplo
Acerca de este flujo de trabajo
Este flujo de trabajo de ComfyUI, titulado 'Imagen Única a Sprite Sheet Animado', transforma una imagen estática en un sprite sheet animado y dinámico. Utilizando el modelo Nano Banana 2, el flujo aprovecha capacidades avanzadas de IA para interpretar y animar la imagen según los prompts definidos por el usuario. Nodos clave como SaveImage, LoadImage y VHS_VideoCombine trabajan en conjunto para crear una secuencia de animación fluida. El flujo también incorpora nodos personalizados como comfyui-kjnodes y comfyui-rmbg para mejorar el proceso de animación eliminando fondos y combinando cuadros de video eficientemente. Este flujo es especialmente útil para desarrolladores de juegos y animadores que buscan generar rápidamente recursos animados a partir de imágenes estáticas.
Preguntas y respuestas
Imágenes de alta resolución con sujetos claros y poco fondo funcionan mejor para asegurar una animación precisa y fluida.
Sí, puedes especificar el número de cuadros y el tipo de animación en el cuadro de prompt para adaptar la salida a tus necesidades.
Sí, el flujo incluye capacidades de eliminación de fondo usando el nodo comfyui-rmbg, asegurando una salida limpia y transparente.
El sprite sheet se puede guardar en varios formatos, incluyendo GIF y WebM, usando el nodo SaveImageWithAlpha.