Skip to content

Instantly share code, notes, and snippets.

@Glidias
Created October 7, 2025 06:06
Show Gist options
  • Save Glidias/a7a9068cd9219eeae7281d7f74597048 to your computer and use it in GitHub Desktop.
Save Glidias/a7a9068cd9219eeae7281d7f74597048 to your computer and use it in GitHub Desktop.
Krita SAM2 ComfyUI API workflow
{
"7": {
"inputs": {
"keep_model_loaded": true,
"individual_objects": [
"129",
0
],
"sam2_model": [
"9",
0
],
"image": [
"150",
0
],
"coordinates_positive": [
"152",
1
],
"coordinates_negative": [
"155",
1
]
},
"class_type": "Sam2Segmentation",
"_meta": {
"title": "Sam2Segmentation"
}
},
"9": {
"inputs": {
"model": "sam2_hiera_large.safetensors",
"segmentor": [
"103",
0
],
"device": "cuda",
"precision": "fp16"
},
"class_type": "DownloadAndLoadSAM2Model",
"_meta": {
"title": "(Down)Load SAM2Model"
}
},
"30": {
"inputs": {
"mask": [
"46",
0
]
},
"class_type": "MaskToImage",
"_meta": {
"title": "Convert Mask to Image"
}
},
"46": {
"inputs": {
"expand": [
"120",
0
],
"incremental_expandrate": 0,
"tapered_corners": [
"118",
0
],
"flip_input": [
"122",
0
],
"blur_radius": [
"124",
0
],
"lerp_alpha": 1,
"decay_factor": 1,
"fill_holes": [
"113",
0
],
"mask": [
"7",
0
]
},
"class_type": "GrowMaskWithBlur",
"_meta": {
"title": "Grow Mask With Blur"
}
},
"88": {
"inputs": {
"image": [
"150",
0
]
},
"class_type": "GetImageSize",
"_meta": {
"title": "Get Image Size"
}
},
"89": {
"inputs": {
"comparison": ">",
"a": [
"88",
2
],
"b": [
"90",
0
]
},
"class_type": "SimpleComparison+",
"_meta": {
"title": "🔧 Simple Comparison"
}
},
"90": {
"inputs": {
"value": 1
},
"class_type": "INTConstant",
"_meta": {
"title": "1"
}
},
"100": {
"inputs": {
"text": "video"
},
"class_type": "CR Text",
"_meta": {
"title": "🔤 CR Text video"
}
},
"102": {
"inputs": {
"text": "single_image"
},
"class_type": "CR Text",
"_meta": {
"title": "🔤 CR Text single_image"
}
},
"103": {
"inputs": {
"cond": [
"89",
0
],
"tt_value": [
"100",
0
],
"ff_value": [
"102",
0
]
},
"class_type": "ImpactConditionalBranch",
"_meta": {
"title": "ImpactConditionalBranch"
}
},
"108": {
"inputs": {
"images": [
"159",
0
]
},
"class_type": "ETN_KritaOutput",
"_meta": {
"title": "Krita Output"
}
},
"113": {
"inputs": {
"name": "26. fill_holes",
"type": "toggle",
"default": false
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"118": {
"inputs": {
"name": "25. tapered_corners",
"type": "toggle",
"default": false
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"120": {
"inputs": {
"name": "13. expand",
"type": "number (integer)",
"default": 0,
"min": -16384,
"max": 16384
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"122": {
"inputs": {
"name": "31. flip_input",
"type": "toggle",
"default": false
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"124": {
"inputs": {
"name": "14. blur_radius",
"type": "number",
"default": 0,
"min": 0,
"max": 100
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"129": {
"inputs": {
"name": "3. individual_objects",
"type": "toggle",
"default": false
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"150": {
"inputs": {
"name": "Image"
},
"class_type": "ETN_KritaImageLayer",
"_meta": {
"title": "Krita Image Layer"
}
},
"151": {
"inputs": {
"name": "1. coordinates",
"type": "text",
"default": "",
"min": 0,
"max": 0
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"152": {
"inputs": {
"json_input": [
"151",
0
],
"key": "coordinates_positive"
},
"class_type": "JSONKeyCheckerNode",
"_meta": {
"title": "JSON Key Checker"
}
},
"155": {
"inputs": {
"json_input": [
"151",
0
],
"key": "coordinates_negative"
},
"class_type": "JSONKeyCheckerNode",
"_meta": {
"title": "JSON Key Checker"
}
},
"157": {
"inputs": {
"width": [
"88",
0
],
"height": [
"88",
1
],
"batch_size": [
"88",
2
],
"color": [
"161",
0
]
},
"class_type": "EmptyImage",
"_meta": {
"title": "EmptyImage"
}
},
"159": {
"inputs": {
"cond": [
"160",
0
],
"tt_value": [
"162",
0
],
"ff_value": [
"30",
0
]
},
"class_type": "ImpactConditionalBranch",
"_meta": {
"title": "ImpactConditionalBranch"
}
},
"160": {
"inputs": {
"name": "32. rgba_output",
"type": "toggle",
"default": false
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"161": {
"inputs": {
"name": "33. rgb_color",
"type": "number (integer)",
"default": 16777215,
"min": 0,
"max": 16777215
},
"class_type": "ETN_Parameter",
"_meta": {
"title": "Parameter"
}
},
"162": {
"inputs": {
"invert": false,
"image": [
"157",
0
],
"mask": [
"46",
0
]
},
"class_type": "ComposeRGBAImageFromMask",
"_meta": {
"title": "Compose RGBA Image From Mask"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment