ComfyUI Workflow

View and download your workflow JSON

{
  "last_node_id": 15,
  "last_link_id": 13,
  "nodes": [
    {
      "id": 1,
      "type": "LoadImage",
      "pos": [
        100,
        100
      ],
      "size": [
        320,
        280
      ],
      "flags": {},
      "order": 0,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "IMAGE",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        "source_face.png",
        "image"
      ]
    },
    {
      "id": 2,
      "type": "LoadImage",
      "pos": [
        100,
        450
      ],
      "size": [
        320,
        280
      ],
      "flags": {},
      "order": 1,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "IMAGE",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        "target_image.png",
        "image"
      ]
    },
    {
      "id": 3,
      "type": "LoadImageMask",
      "pos": [
        480,
        100
      ],
      "size": [
        320,
        280
      ],
      "flags": {},
      "order": 2,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "MASK",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        "source_face.png",
        "image",
        0
      ]
    },
    {
      "id": 4,
      "type": "LoadImageMask",
      "pos": [
        480,
        450
      ],
      "size": [
        320,
        280
      ],
      "flags": {},
      "order": 3,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "MASK",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        "target_image.png",
        "image",
        0
      ]
    },
    {
      "id": 5,
      "type": "ReActorFaceSwap",
      "pos": [
        860,
        275
      ],
      "size": [
        400,
        300
      ],
      "flags": {},
      "order": 4,
      "mode": 0,
      "inputs": [
        [
          "source_image",
          0
        ],
        [
          "target_image",
          0
        ],
        [
          "source_face_index",
          0
        ],
        [
          "target_face_index",
          0
        ],
        [
          "mask_source",
          0
        ],
        [
          "mask_target",
          0
        ]
      ],
      "outputs": [
        [
          "IMAGE",
          0
        ],
        [
          "FACE_MODEL",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        0,
        0,
        "true",
        "false",
        "false",
        0.5,
        "GFPGAN",
        0.5,
        "None",
        1.0,
        "true",
        "false"
      ]
    },
    {
      "id": 6,
      "type": "PreviewImage",
      "pos": [
        1320,
        100
      ],
      "size": [
        320,
        280
      ],
      "flags": {},
      "order": 5,
      "mode": 0,
      "inputs": [
        [
          "images",
          0
        ]
      ],
      "outputs": [],
      "properties": {},
      "widgets_values": []
    },
    {
      "id": 7,
      "type": "SaveImage",
      "pos": [
        1320,
        450
      ],
      "size": [
        320,
        280
      ],
      "flags": {},
      "order": 6,
      "mode": 0,
      "inputs": [
        [
          "images",
          0
        ]
      ],
      "outputs": [],
      "properties": {},
      "widgets_values": [
        "ComfyUI",
        "FaceSwap_Result"
      ]
    },
    {
      "id": 8,
      "type": "PrimitiveInt",
      "pos": [
        480,
        780
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 7,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "INT",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        0
      ]
    },
    {
      "id": 9,
      "type": "PrimitiveInt",
      "pos": [
        480,
        880
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 8,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "INT",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        0
      ]
    },
    {
      "id": 10,
      "type": "PrimitiveFloat",
      "pos": [
        480,
        980
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 9,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "FLOAT",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        0.5
      ]
    },
    {
      "id": 11,
      "type": "PrimitiveFloat",
      "pos": [
        480,
        1080
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 10,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "FLOAT",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        1.0
      ]
    },
    {
      "id": 12,
      "type": "PrimitiveBoolean",
      "pos": [
        100,
        780
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 11,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "BOOLEAN",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        true
      ]
    },
    {
      "id": 13,
      "type": "PrimitiveBoolean",
      "pos": [
        100,
        880
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 12,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "BOOLEAN",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        false
      ]
    },
    {
      "id": 14,
      "type": "PrimitiveBoolean",
      "pos": [
        100,
        980
      ],
      "size": [
        200,
        60
      ],
      "flags": {},
      "order": 13,
      "mode": 0,
      "inputs": [],
      "outputs": [
        [
          "BOOLEAN",
          0
        ]
      ],
      "properties": {},
      "widgets_values": [
        true
      ]
    },
    {
      "id": 15,
      "type": "Note",
      "pos": [
        100,
        1100
      ],
      "size": [
        400,
        200
      ],
      "flags": {},
      "order": 14,
      "mode": 0,
      "inputs": [],
      "outputs": [],
      "properties": {},
      "widgets_values": [
        "Face Swap Application\n\n1. Load source face image (face to extract)\n2. Load target image (image to swap face into)\n3. Optional: Load masks for precise control\n4. Adjust settings:\n   - Face indices: Select which face if multiple\n   - Face restoration: Enable GFPGAN/CodeFormer\n   - Strength: Adjust blend intensity\n   - Upscaler: Optional face upscaling\n\nBuilt with anycoder - https://huggingface.co/spaces/akhaliq/anycoder"
      ]
    }
  ],
  "links": [
    [
      1,
      1,
      5,
      0,
      "IMAGE"
    ],
    [
      2,
      2,
      5,
      1,
      "IMAGE"
    ],
    [
      3,
      3,
      5,
      5,
      "MASK"
    ],
    [
      4,
      4,
      5,
      6,
      "MASK"
    ],
    [
      5,
      5,
      6,
      0,
      "IMAGE"
    ],
    [
      5,
      5,
      7,
      0,
      "IMAGE"
    ],
    [
      8,
      0,
      5,
      2,
      "INT"
    ],
    [
      9,
      0,
      5,
      3,
      "INT"
    ],
    [
      10,
      0,
      5,
      6,
      "FLOAT"
    ],
    [
      11,
      0,
      5,
      9,
      "FLOAT"
    ],
    [
      12,
      0,
      5,
      4,
      "BOOLEAN"
    ],
    [
      13,
      0,
      5,
      5,
      "BOOLEAN"
    ],
    [
      14,
      0,
      5,
      10,
      "BOOLEAN"
    ]
  ],
  "groups": [
    {
      "title": "Source Face",
      "bounding": [
        80,
        80,
        740,
        320
      ],
      "color": "#3f789e",
      "font_size": 24
    },
    {
      "title": "Target Image",
      "bounding": [
        80,
        430,
        740,
        320
      ],
      "color": "#8f3e8e",
      "font_size": 24
    },
    {
      "title": "Face Swap Settings",
      "bounding": [
        80,
        760,
        620,
        400
      ],
      "color": "#5e8f3e",
      "font_size": 24
    },
    {
      "title": "Output",
      "bounding": [
        1300,
        80,
        360,
        670
      ],
      "color": "#bf5f3f",
      "font_size": 24
    }
  ],
  "config": {},
  "extra": {
    "workspace_info": {
      "app_mode": true,
      "app_inputs": [
        {
          "node_id": 1,
          "name": "Source Face",
          "type": "image",
          "description": "Upload the face image to extract"
        },
        {
          "node_id": 2,
          "name": "Target Image",
          "type": "image",
          "description": "Upload the image to swap face into"
        },
        {
          "node_id": 8,
          "name": "Source Face Index",
          "type": "int",
          "description": "Which face to use from source (0 = first face)"
        },
        {
          "node_id": 9,
          "name": "Target Face Index",
          "type": "int",
          "description": "Which face to replace in target (0 = first face)"
        },
        {
          "node_id": 10,
          "name": "Face Restoration Strength",
          "type": "float",
          "description": "GFPGAN/CodeFormer restoration strength (0-1)"
        },
        {
          "node_id": 11,
          "name": "Upscale Factor",
          "type": "float",
          "description": "Face upscaling multiplier"
        },
        {
          "node_id": 12,
          "name": "Enable Face Restoration",
          "type": "boolean",
          "description": "Apply face restoration after swap"
        },
        {
          "node_id": 13,
          "name": "Enable Mask",
          "type": "boolean",
          "description": "Use masks for precise face placement"
        },
        {
          "node_id": 14,
          "name": "Save Output",
          "type": "boolean",
          "description": "Save the result to disk"
        }
      ],
      "app_outputs": [
        {
          "node_id": 6,
          "name": "Preview",
          "description": "Preview the face swap result"
        }
      ],
      "app_title": "Face Swap Studio",
      "app_description": "Swap faces between two images with advanced controls for face selection, restoration, and upscaling. Upload a source face and target image to create realistic face swaps.",
      "app_theme": "modern",
      "app_layout": "horizontal"
    }
  }
}