Introduction:
- ComfyUI_roop Repository
- Stars: 77
- Author: ssitu
roop Introduction
The roop
node, and its improved version RoopImproved
, are custom nodes for ComfyUI designed for face swapping. Based on the original roop project, these nodes allow users to seamlessly replace faces in images with faces from a reference image. The nodes integrate directly into ComfyUI workflows, making face swapping an accessible part of image generation and manipulation pipelines.
roop Input Introduction
The roop
node accepts the following inputs:
- image (
IMAGE
): The target image where the face(s) will be swapped. This input expects a batch of images in tensor format. - reference_image (
IMAGE
): The reference image containing the face(s) to be used for swapping. This should also be in tensor format. - swap_model (
list(model_names().keys())
): A selection of available face swap models. The models are loaded from thescripts.faceswap
module and are listed by their base file name. - faces_index (
STRING
,{"default": "0"}
): A comma-separated string specifying the index(es) of the face(s) to be swapped in the target image. Defaults to "0" (the first face found). - reference_faces_index (
STRING
,{"default": "0"}
): A comma-separated string specifying the index(es) of the face(s) to be used from the reference image. Defaults to "0". - console_logging_level
([0, 1, 2],)
: An integer representing the desired level of console logging (0 for minimal, 2 for verbose).
The RoopImproved
node expands on these inputs with additional options for controlling face ordering:
- face_order
(ORDERINGS, {"default": DEFAULT_ORDERING})
: Specifies the order in which faces are processed, such as "left to right", "up to down", or "largest to smallest". Defaults to "left to right". - reverse_order (
BOOLEAN
,{"default": False}
): A boolean indicating whether the face order should be reversed. - reference_order
(ORDERINGS, {"default": DEFAULT_ORDERING})
: Specifies the order in which faces are selected from the reference image. Defaults to "left to right". - reverse_reference_order (
BOOLEAN
,{"default": False}
): A boolean indicating whether the reference face order should be reversed.
roop Output Introduction
Both roop
and RoopImproved
nodes produce a single output:
- IMAGE (
IMAGE
): The resulting image(s) with the face(s) swapped, in tensor format.
roop Usage Tips
- Model Selection: Experiment with different
swap_model
options to find the best fit for your source and target faces. - Face Indexing: Use
faces_index
andreference_faces_index
to precisely control which faces are swapped. When multiple faces are detected, specifying the correct index is crucial. Multiple indices can be provided as a comma-separated string (e.g., "0,2" to swap the first and third faces). - Ordering Options (RoopImproved): The
face_order
options inRoopImproved
can be helpful when dealing with images containing multiple faces, ensuring that the correct faces are matched between the source and reference images. - Logging: Adjust
console_logging_level
for debugging or to monitor the face-swapping process. - Image Preprocessing: Ensure that both the target and reference images are of sufficient quality and resolution for optimal face detection and swapping.
- Batch Processing: The node accepts a batch of images as input, allowing for efficient processing of multiple images with the same settings.
- Dependencies: Ensure that all required dependencies for the
roop
project are installed, including the face swap models and any necessary Python packages.