Skip to content
snappy2 detect faces in photos and draw overlay image filters using neural networks
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Snappy 2


Detect faces in photos and draw overlay images on it, the overlay drawn using neural network that detects face keypoints.

  • draw glasses
  • draw mustache
  • draw hat
  • draw ears
  • draw any overlay
  • draw text

[ Cover Image ]

This version 2 beta built on previous version snappy v1 beta


  1. Snappy2: main class object and one place for all snappy library control.
  2. Detector: if you want to use the library in more advanced way by getting key points dictionary.
  3. FacePainter: helper to draw on top of images based on received key points dictionary.

[ Snappy2 Structure ]


Download the required libraries for code using following terminal command:

  • Option 1: install requirements directly
cd requirements
pip install -r requirements.txt
  • Option 2: Import anaconda environment
cd requirements
conda env create -f snappy2.yml
soruce activate snappy2

if you don't have anaconda download from here

Code Examples (How to)

  • Draw Mustache on face (3 lines)
human_image ='<file_path>')

snappy2 = Snappy2()
snappy2.set_mustache(human_image, mus_index=0)

[ Mustache Image ]

  • Draw glasses on face (3 lines)
human_image ='<file_path>')

snappy2 = Snappy2()
snappy2.set_glasses(human_image, gls_index=0)

[ Glass Image ]

  • Draw ears on face (3 lines)
human_image ='<file_path>')

snappy2 = Snappy2()
snappy2.set_ears(human_image, gls_index=0)

[ Ears Image ]

For more examples and code details use check (


import Snappy2 as snappy2


1- Ahmad Barqawi (
2- Contribute and add your name here


This library uses photos available free in the internet, if any of example photos have license please contact the library owner directly to add the license or delete the content. Expected response on requests within 3 days.

  • Overlays provided from freepik
  • Faces provided from unsplash free data set


The MIT License (MIT)

Copyright (c) 2017 Ahmad Barqawi (

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
You can’t perform that action at this time.