Put your product in a new scene
Place a product into a new setting and match its lighting to the scene.
Descargar flujo de trabajoProbar en Cloud Documentación de la API
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
- Autor
- Rob
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.
1 Obtener clave de API ↗
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({
"1": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image1_FILENAME"
},
"_meta": {
"title": "Load Product Image"
}
},
"2": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image2_FILENAME"
},
"_meta": {
"title": "Load Background Image"
}
},
"12": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Task: Realistic Product Compositing with Material Preservation Goal: Insert the product from Input 2 into Input 1, ensuring placement is logical and lighting interacts accurately with the product's specific material properties.\n\nInput Image(s):\n\nInput 1 (Scene)\nInput 2 (Product): {product_description}\n\nManual Material Breakdown (Critical): To ensure correct light interaction, treat the product as having the following physical properties:\n\nPrimary Material: [e.g., Matte Plastic / Brushed Aluminum / Clear Glass]\n\nReflectivity: [e.g., Low (dull reflections) / High (mirror-like)]\n\nTexture: [e.g., Smooth / Grainy / Porous]\n\nReaction to Light: [e.g., \"Should absorb light with soft highlights, no sharp glares\"]\n\nSecondary Material (if any): [e.g., Gold Foil Label / Glossy Cap]\n\nReaction to Light: [e.g., \"Should catch sharp, bright specular highlights from the environment\"]\n\nProcess:\nScene Analysis: Identify the logical ground plane/surface in Input 1.\n\nPlacement: Scale Input 2 uniformly (maintain aspect ratio) and place it on the surface.\n\nMaterial-Based Relighting:\n\nDo not simply overlay the scene colors onto the product.\nInstead, map the environment light from Input 1 onto the contours of Input 2 based on the material definitions above.\n\nExample: If the material is Matte, only the edge lighting and general ambient tone should change; do not add sharp reflections.\n\nExample: If the material is Glossy, reflect the scene's details on the surface.\n\nShadows: Generate contact shadows that match the hardness/softness of shadows in the rest of the scene.\n\nTechnical Requirements:\nAlbedo Preservation: The intrinsic color of the product (e.g., \"Brand Red\") must not be washed out by the scene's lighting color.\n\nTexture Fidelity: Do not smooth out surface details (grain, bumps) during the blending process.\n\nScaling: No non-uniform stretching.\n\nOutput: A composite where the lighting confirms the materiality of the product (e.g., makes the plastic look like plastic, not metal)."
},
"_meta": {
"title": "Prompt Template"
}
},
"13": {
"class_type": "RegexReplace",
"inputs": {
"case_insensitive": True,
"count": 0,
"dotall": False,
"multiline": False,
"regex_pattern": "{product_description}",
"replace": [
"14",
0
],
"string": [
"12",
0
]
},
"_meta": {
"title": "Replace Text (Regex)"
}
},
"14": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "A dispenser bottle filled with viscuous clear liquid, with a metallic top, \"C\" logo and a clear glass body"
},
"_meta": {
"title": "Describe the Product"
}
},
"22": {
"class_type": "ByteDanceSeedreamNode",
"inputs": {
"fail_on_partial": True,
"height": 2048,
"image": [
"15:15",
0
],
"max_images": 1,
"model": "seedream-4-5-251128",
"prompt": [
"13",
0
],
"seed": 406946789,
"sequential_image_generation": "disabled",
"size_preset": "2048x2048 (1:1)",
"watermark": False,
"width": 2048
},
"_meta": {
"title": "ByteDance Seedream 4.5 & 5.0"
}
},
"23": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"22",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"15:15": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"2",
0
],
"images.image1": [
"15:6",
0
]
},
"_meta": {
"title": "Batch Images"
}
},
"15:5": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"2",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"15:6": {
"class_type": "ResizeAndPadImage",
"inputs": {
"image": [
"1",
0
],
"interpolation": "area",
"padding_color": "white",
"target_height": [
"15:5",
1
],
"target_width": [
"15:5",
0
]
},
"_meta": {
"title": "Resize And Pad Image"
}
}
})
workflow.set_input("1", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/comfy_shampoo.png"))
workflow.set_input("2", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/flower_sea.png"))
# 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("23"):
output.to_file(output.name)Probar un ejemplo
Flujos de trabajo relacionados
- Seedream, MiniMax
Turn a product photo into a video
- Seedream, Kling
1 imagen a video de coche
- ByteDance, Seedream, Google Gemini, Nano Banana Pro
Animaciones de logotipo 3D dinámicas
- Flux.2 Dev, Flux.2 Klein, GPT-Image-1.5, Grok, Nano Banana Pro, Qwen-Image-Edit, Seedream
Comparación de 1 entrada y múltiples modelos de edición
- ByteDance, Seedream
Fusión de producto y escena con reiluminación
- ByteDance, Google Gemini, Seedream
Genera póster/anuncio con tu producto
- Seedream, MiniMax
Imagen de producto a video: Zapato