照片轉卡通風格漫畫像
只需上傳照片並選擇 15 種預設卡通風格之一,即可轉換成漫畫像。
關於
此 ComfyUI 工作流程可將一般照片轉換為卡通漫畫像,提供 15 種預設風格。流程以 LoadImage 載入原始照片,CustomCombo 下拉選單選擇風格,JsonExtractString 擷取對應預設參數,StringConcatenate 組合必要識別碼。核心風格化處理由自訂節點(UUID d4c06663-cb1a-4a41-a36b-f09c93e55e7e)執行,輸入原圖與選定風格 key,輸出單張風格化影像。可用 PreviewAny 即時檢查結果,SaveImage 儲存最終圖檔。
預設系統確保不同照片間風格一致且可重現。JSON 映射將易懂的風格名稱與處理節點實際參數分離,方便切換風格而無需調整底層設定。由於主要運算封裝於 d4c06663-cb1a-4a41-a36b-f09c93e55e7e 節點,流程簡潔快速,無需額外載入模型或調整取樣器。
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 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({
"132": {
"class_type": "LoadImage",
"inputs": {
"image": "f91bccebcc07a40d5c61625f96084268613a1845ca64f9472c54e37d7a1733db.png"
},
"_meta": {
"title": "Load Image"
}
},
"197": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Qwen_Edit_2511",
"images": [
"196:175",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"234": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": " ",
"string_a": "Keep the exact same composition, camera framing, crop, pose, character outfit, background, environment, perspective, and lighting as the original photo.",
"string_b": [
"240",
0
]
},
"_meta": {
"title": "Assemble Prompt"
}
},
"235": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"234",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"239": {
"class_type": "CustomCombo",
"inputs": {
"choice": "Classic Caricature"
},
"_meta": {
"title": "Cartoon Style"
}
},
"240": {
"class_type": "JsonExtractString",
"inputs": {
"json_string": "{\n \"Classic Caricature\": \"Transform the attached photo into a caricature portrait in the tradition of classic literary and editorial caricature illustration \\u2014 enlarge the head slightly and perch it on a smaller, elongated body. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Sunday Comics\": \"Transform the attached photo into a vintage Sunday newspaper comic-strip caricature: bold confident ink outlines, flat saturated colors over visible Ben-Day halftone dots, slight newsprint texture and off-register color charm, cheerful panel-ready energy, slightly oversized head on a compact body. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Watercolor Sketch\": \"Transform the attached photo into a loose watercolor caricature sketch: soft pencil underdrawing with expressive, flowing watercolor washes, gentle color bleeds, and airy unpainted paper showing through. Slightly enlarged head with delicate, painterly features. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Street Fair Caricature\": \"Transform the attached photo into a lively caricature done in bold marker and quick airbrush: a big expressive grin, huge head on a tiny dynamic body, spontaneous drawn-while-you-wait energy. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Rubber-Hose\": \"Transform the attached photo into a rubber-hose cartoon: rubberhose animation style, exaggerated stringy limb length, white gloves, thick bouncy outlines, soft film grain and gleeful old-timey charm. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Anime Chibi\": \"Transform the attached photo into a chibi anime caricature: super-deformed proportions with an oversized head and tiny body, huge expressive sparkling eyes, simplified button nose, clean cel-shaded line art. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Vinyl Collectible\": \"Transform the attached photo into a glossy 3D collectible vinyl-toy caricature figure: smooth sculpted surfaces, oversized head on a small stylized body, soft studio lighting with clean reflections, premium designer-toy finish. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Oil Painting Satire\": \"Transform the attached photo into an 18th-century oil painting caricature: rich visible brushwork, warm old-master palette, theatrical chiaroscuro lighting, varnished gallery finish, subtly exaggerated proportions in the grand satirical portrait tradition. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Inflatable Balloon\": \"Transform the attached photo into a shiny inflatable balloon caricature: taut glossy balloon-vinyl skin, softly over-inflated puffy cheeks and limbs, visible welded seams and a small inflation valve, squeaky rubber highlights, buoyant parade-float presence. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Claymation\": \"Transform the attached photo into a hand-sculpted claymation caricature: matte plasticine surface with visible thumbprints and sculpting-tool marks, slightly lumpy hand-modeled shapes, big expressive sculpted brow and smile, stop-motion charm. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Paper Cutout\": \"Transform the attached photo into a layered paper-cutout collage caricature: flat construction-paper shapes with torn and scissor-cut edges, visible drop shadows between paper layers, slightly wobbly hand-cut lines, bold flat colors. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Pixel Sprite\": \"Transform the attached photo into a retro 16-bit pixel-art sprite caricature: chunky visible pixels, limited vibrant color palette, crisp dithered shading, oversized head sprite proportions. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Bobblehead\": \"Transform the attached photo into a plastic exaggerated extremely large bobblehead figurine caricature: oversized wobbling head on a small neck and rigid body, hand-painted finish with subtle brush marks, collectible desk-toy presence. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\",\n \"Neon Airbrush\": \"Transform the attached photo into a 90s neon airbrush caricature: vivid fluorescent airbrushed gradients over deep black shading, glowing neon rim light, confident freehand spray strokes, retro boardwalk T-shirt art energy. Preserve the subject's true likeness and identity while wittily exaggerating their most distinctive features.\"\n}",
"key": [
"239",
0
]
},
"_meta": {
"title": "Style Prompt (JSON)"
}
},
"196:152": {
"class_type": "CFGNorm",
"inputs": {
"model": [
"196:155",
0
],
"pre_cfg": False,
"strength": 1
},
"_meta": {
"title": "CFGNorm"
}
},
"196:155": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"196:166",
0
],
"sampling": "flow",
"shift": 3.1
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"196:156": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"196:161": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"196:167",
0
],
"image1": [
"196:176",
0
],
"prompt": [
"235",
0
],
"vae": [
"196:156",
0
]
},
"_meta": {
"title": "TextEncodeQwenImageEditPlus (Positive)"
}
},
"196:162": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors",
"model": [
"196:152",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"196:163": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 4
},
"_meta": {
"title": "CFG"
}
},
"196:164": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 1
},
"_meta": {
"title": "CFG"
}
},
"196:165": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"196:176",
0
],
"vae": [
"196:156",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"196:166": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_edit_2511_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"196:167": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"196:168": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"196:152",
0
],
"on_true": [
"196:162",
0
],
"switch": [
"196:171",
0
]
},
"_meta": {
"title": "Switch (Model)"
}
},
"196:169": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 6
},
"_meta": {
"title": "Steps"
}
},
"196:170": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 30
},
"_meta": {
"title": "Steps"
}
},
"196:171": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Enable 4steps LoRA?"
}
},
"196:172": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"196:163",
0
],
"on_true": [
"196:164",
0
],
"switch": [
"196:171",
0
]
},
"_meta": {
"title": "Switch (CFG)"
}
},
"196:173": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"196:170",
0
],
"on_true": [
"196:169",
0
],
"switch": [
"196:171",
0
]
},
"_meta": {
"title": "Switch (Steps)"
}
},
"196:174": {
"class_type": "KSampler",
"inputs": {
"cfg": [
"196:172",
0
],
"denoise": 1,
"latent_image": [
"196:165",
0
],
"model": [
"196:168",
0
],
"negative": [
"196:229",
0
],
"positive": [
"196:161",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 1029537144521435,
"steps": [
"196:173",
0
]
},
"_meta": {
"title": "KSampler"
}
},
"196:175": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"196:174",
0
],
"vae": [
"196:156",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"196:176": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"132",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"196:229": {
"class_type": "TextEncodeQwenImageEditPlus",
"inputs": {
"clip": [
"196:167",
0
],
"image1": [
"196:176",
0
],
"prompt": "",
"vae": [
"196:156",
0
]
},
"_meta": {
"title": "Text Encode Qwen Image Edit Plus"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
僅當處理節點(d4c06663-cb1a-4a41-a36b-f09c93e55e7e)支援新風格 key 時可擴充。請更新餵給 JsonExtractString 的 JSON 預設,並於 CustomCombo 新增選項。若節點不支援新 key,則會回退或失敗。
視你的系統上自訂處理節點的實作而定。多數風格化節點偏好 GPU,速度較快,但部分版本可在 CPU 上執行(速度較慢)。
最短邊 512–1024 像素的人像效果最佳。建議裁切至頭肩,光線均勻,避免嚴重模糊。
本流程以單張輸入為主。若需批次,請複製分支或換用支援批次的載入節點,並將同樣的 CustomCombo/JSON 預設映射餵給處理節點。