遊戲資源風格遷移精靈圖產生器
使用輪廓參考和風格參考作為輸入,產生2D精靈作為模型紋理。適用於2D/2.5D遊戲的背景佈景。
下載工作流程在 Cloud 中試用 API 文件
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview執行於
- 輸出
- 圖片
- 作者
- ComfyUI
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
1 取得 API 金鑰 ↗
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
下載 API JSONAPI 文件 ↗
# 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_style_image_FILENAME"
},
"_meta": {
"title": "Style Reference"
}
},
"2": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_object_image_FILENAME"
},
"_meta": {
"title": "Sprite Reference"
}
},
"3": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "texture_alpha",
"images": [
"4",
0
]
},
"_meta": {
"title": "Save texture with alpha"
}
},
"4": {
"class_type": "RecraftRemoveBackgroundNode",
"inputs": {
"image": [
"8",
0
]
},
"_meta": {
"title": "Recraft Remove Background"
}
},
"5": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "texture",
"images": [
"8",
0
]
},
"_meta": {
"title": "Save texture"
}
},
"7": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": {
"__value__": [
"",
""
]
},
"image_a": [
"2",
0
],
"image_b": [
"8",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"8": {
"class_type": "GeminiImage2Node",
"inputs": {
"aspect_ratio": "1:1",
"images": [
"16",
0
],
"model": "gemini-3-pro-image-preview",
"prompt": [
"21",
0
],
"resolution": "1K",
"response_modalities": "IMAGE",
"seed": 605332021762553,
"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."
},
"_meta": {
"title": "Nano Banana Pro (Google Gemini Image)"
}
},
"16": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"2",
0
],
"images.image1": [
"1",
0
]
},
"_meta": {
"title": "Batch Images"
}
},
"17": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": "",
"string_a": [
"19",
0
],
"string_b": [
"22",
0
]
},
"_meta": {
"title": "Concatenate Text"
}
},
"19": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "strictly preserve the composition and outline of image 1. Reskin image 1 as "
},
"_meta": {
"title": "Text (Multiline)"
}
},
"20": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": " and restyle into the style of image 2. Black background"
},
"_meta": {
"title": "Text (Multiline)"
}
},
"21": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": "",
"string_a": [
"17",
0
],
"string_b": [
"20",
0
]
},
"_meta": {
"title": "Concatenate Text"
}
},
"22": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "art deco brass siphon pump"
},
"_meta": {
"title": "Object Prompt"
}
}
})
workflow.set_input("2", "image", client.assets.from_url("https://comfy.org/catalog-media/28407515-9896-487f-940f-aefd88e11731/775ff4e9-4158-4142-b3d6-b21946b30c52"))
workflow.set_input("1", "image", client.assets.from_url("https://comfy.org/catalog-media/884c68fb-ed2d-4c97-9097-70a055e180d4/e7f07b36-50b9-4898-ad55-e5d020356d1e"))
# 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("3"):
output.to_file(output.name)
for output in job.get_outputs("5"):
output.to_file(output.name)試試範例
關於此工作流程
遊戲素材風格轉換精靈生成器工作流程專為遊戲開發者打造,能快速產生獨特 2D 精靈素材。透過 Nano Banana Pro 模型,允許用戶輸入輪廓參考與風格參考,生成細緻 2D 精靈,可作為模型材質。特別適合 2D 或 2.5D 遊戲場景,讓背景元素與遊戲美術風格無縫融合。
流程串接多個節點,包括 LoadImage 與 SaveImage 處理輸入與輸出圖像,RecraftRemoveBackgroundNode 負責去除輸入圖像多餘背景。GeminiImage2Node 為關鍵,負責風格轉換,將輪廓與風格參考融合為一體。流程也用 ImageCompare 節點進行品質檢查,BatchImagesNode 則支援多圖高效處理。這些節點組合確保精靈既符合風格又具高視覺品質,是遊戲素材製作的利器。
問答
建議用高對比、輪廓清晰與風格明確的圖像,以獲得最佳風格轉換效果。
可以,BatchImagesNode 支援高效多圖處理,適合大型專案。
請精選與目標風格相近的參考圖像,並用 ImageCompare 節點微調結果。
可以,在 GeminiImage2Node 內可調整參數,控制風格轉換強度與效果。