ComfyUI / workflows /api /outpaint-lama.json
aleph65's picture
Upload workflows/api/outpaint-lama.json with huggingface_hub
bcd2b09 verified
Raw
History Blame Contribute Delete
5.71 kB
{
"1": {
"_meta": {
"title": "Source Image"
},
"class_type": "LoadImage",
"inputs": {
"image": "example.png"
}
},
"10": {
"_meta": {
"title": "Resize to fit target"
},
"class_type": "ImageScale",
"inputs": {
"crop": "disabled",
"height": [
"9",
0
],
"image": [
"1",
0
],
"upscale_method": "lanczos",
"width": [
"8",
0
]
}
},
"11": {
"_meta": {
"title": "pad left"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"10",
0
],
"b": [
"2",
0
],
"c": [
"4",
0
],
"expression": "max(floor((b - a.width) * c), 0)"
}
},
"12": {
"_meta": {
"title": "pad right"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"10",
0
],
"b": [
"2",
0
],
"c": [
"11",
0
],
"expression": "max(b - a.width - c, 0)"
}
},
"13": {
"_meta": {
"title": "pad top"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"10",
0
],
"b": [
"3",
0
],
"c": [
"5",
0
],
"expression": "max(floor((b - a.height) * c), 0)"
}
},
"14": {
"_meta": {
"title": "pad bottom"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"10",
0
],
"b": [
"3",
0
],
"c": [
"13",
0
],
"expression": "max(b - a.height - c, 0)"
}
},
"15": {
"_meta": {
"title": "Pad to exact target"
},
"class_type": "ImagePadForOutpaint",
"inputs": {
"bottom": [
"14",
0
],
"feathering": [
"6",
0
],
"image": [
"10",
0
],
"left": [
"11",
0
],
"right": [
"12",
0
],
"top": [
"13",
0
]
}
},
"16": {
"_meta": {
"title": "keep-region mask"
},
"class_type": "InvertMask",
"inputs": {
"mask": [
"15",
1
]
}
},
"17": {
"_meta": {
"title": "Inpaint model (MAT / big-lama)"
},
"class_type": "INPAINT_LoadInpaintModel",
"inputs": {
"model_name": "MAT_Places512_G_fp16.safetensors"
}
},
"18": {
"_meta": {
"title": "Fill upscaler (fixes low-res fill)"
},
"class_type": "UpscaleModelLoader",
"inputs": {
"model_name": "RealESRGAN_x4plus.pth"
}
},
"19": {
"_meta": {
"title": "LaMa/MAT fill"
},
"class_type": "INPAINT_InpaintWithModel",
"inputs": {
"image": [
"15",
0
],
"inpaint_model": [
"17",
0
],
"mask": [
"15",
1
],
"optional_upscale_model": [
"18",
0
],
"seed": 0
}
},
"2": {
"_meta": {
"title": "target_width"
},
"class_type": "PrimitiveInt",
"inputs": {
"value": 1216
}
},
"20": {
"_meta": {
"title": "Snap to exact target dims"
},
"class_type": "ImageScale",
"inputs": {
"crop": "disabled",
"height": [
"3",
0
],
"image": [
"19",
0
],
"upscale_method": "lanczos",
"width": [
"2",
0
]
}
},
"21": {
"_meta": {
"title": "Paste original pixels back"
},
"class_type": "ImageCompositeMasked",
"inputs": {
"destination": [
"20",
0
],
"mask": [
"16",
0
],
"resize_source": false,
"source": [
"15",
0
],
"x": 0,
"y": 0
}
},
"22": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "outpaint/lama",
"images": [
"21",
0
]
}
},
"3": {
"_meta": {
"title": "target_height"
},
"class_type": "PrimitiveInt",
"inputs": {
"value": 1216
}
},
"4": {
"_meta": {
"title": "anchor_x (0=left 0.5=center 1=right)"
},
"class_type": "PrimitiveFloat",
"inputs": {
"value": 0.5
}
},
"5": {
"_meta": {
"title": "anchor_y (0=top 0.5=center 1=bottom)"
},
"class_type": "PrimitiveFloat",
"inputs": {
"value": 0.5
}
},
"6": {
"_meta": {
"title": "feathering (px)"
},
"class_type": "PrimitiveInt",
"inputs": {
"value": 16
}
},
"7": {
"_meta": {
"title": "fit scale"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"1",
0
],
"b": [
"2",
0
],
"c": [
"3",
0
],
"expression": "min(b / a.width, c / a.height)"
}
},
"8": {
"_meta": {
"title": "fit width"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"1",
0
],
"b": [
"7",
1
],
"c": [
"2",
0
],
"expression": "min(round(a.width * b), c)"
}
},
"9": {
"_meta": {
"title": "fit height"
},
"class_type": "MathExpression|pysssss",
"inputs": {
"a": [
"1",
0
],
"b": [
"7",
1
],
"c": [
"3",
0
],
"expression": "min(round(a.height * b), c)"
}
}
}