The Face Cropper Node (MarwanFaceCropping) is a custom image processing node designed for ComfyUI. It takes an input image and crops it to a 2:3 aspect ratio, ensuring that most of the subject remains in the frame while maintaining the correct proportions.
The Face Cropper Node (MarwanFaceCropping
) is a custom image processing node designed for ComfyUI. It takes an input image and crops it to a 2:3 aspect ratio, ensuring that most of the subject remains in the frame while maintaining the correct proportions.
git clone https://github.com/marawan206/ComfyUI-FaceCropper.git
cd face-cropper-node
pip install torch pytest
The node expects an input image tensor of shape (batch, height, width, channels)
, where:
batch
is the number of images.height
remains unchanged.width
is adjusted to maintain a 2:3 ratio.Example:
import torch
from face_cropper_node import MarwanFaceCropping
image = torch.rand(1, 1024, 1024, 3) # Example input image
node = MarwanFaceCropping()
cropped, = node.execute(image)
print(cropped.shape) # Output shape should be (1, 1024, 682, 3)
To verify functionality, run:
pytest test.py
Feel free to submit issues or pull requests to improve the node.
MIT License. See LICENSE
for details.