A Python face morphing tool that creates seamless face composites by blending facial features from two images. Uses MediaPipe for 468-point facial landmark detection and OpenCV for image processing.
| Image 1 | Image 2 | Result |
|---|---|---|
![]() |
![]() |
![]() |
- Automatic face detection and alignment
- Skin tone matching between faces
- Delaunay triangulation for smooth morphing
- EXIF orientation correction
- Batch processing support
- Configurable blend ratios
git clone https://github.com/yourusername/FaceBlend.git
cd FaceBlend
pip install -r requirements.txtpython face_blender.py person1.png person2.png -o result.jpg- Add face images (PNG/JPG) to the
Faces/directory - Edit
Faces.txtwith pairs to blend:Alice, Bob Person1, Person2 - Run:
python batch_blend.py
Results are saved to Results/.
| Option | Description | Default |
|---|---|---|
-o, --output |
Output filename | blended_result.jpg |
-s, --size |
Output size in pixels | 600 |
-b, --blend |
Blend ratio (0.0-1.0) | 0.5 |
0.0= Features mostly from image 10.5= Equal blend from both images1.0= Features mostly from image 2
FaceBlend/
├── face_blender.py # Core morphing engine
├── batch_blend.py # Batch processing script
├── requirements.txt # Python dependencies
├── Faces.txt # Face pairs configuration
├── Faces/ # Input images (PNG/JPG)
└── Results/ # Output images
- Python 3.8+
- Frontal or near-frontal face photos
- Clear, well-lit images
- Detects 468 facial landmarks using MediaPipe
- Normalizes face orientation and skin tones
- Creates Delaunay triangulation mesh
- Warps triangles using affine transforms
- Blends features with multi-tier masking
- Composites hair from image 1 onto final result
- Requires clearly visible, roughly frontal faces
- Extreme profile angles may fail detection
- Hair is always taken from the first image
MIT License - see LICENSE for details.


