Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Some useful extensions to thumbor - extra filters and detectors.

Project description


Some useful extensions to thumbor - extra filters and detectors.

pip install thumbor_extras


Add these detectors to your thumbor.conf:



example of face detector on a lemur


An improved face detector that uses a deep neural network. More specifically, it uses the SSD object detection model, trained specifically on faces. According to the OpenCV repo, it was trained with "some huge and available online dataset." :/

For more information on how the normal thumbor face detector compares to this one in both accuracy and efficiency, see this comparison script.


example of object detector on two cats


The full SSD object detection model, trained on the COCO dataset. It was built as a MobileNet, a class of efficient, light weight deep neural network models meant to work well in mobile and embedded applications.


Add these filters to your available filters in thumbor.conf:

    ...other filters,


Draws a circle at the calculated center of mass, according to the focal points.

Usage: draw_center_of_mass([r, g, b])


  • draw_center_of_mass(): draws a circle with default red color.
  • draw_center_of_mass(0,0,255): draws a blue circle.


Draws a box around the focal points, for displaying the results of the detectors on a given image. Takes optional arguments for box color and line width.

Usage: draw_focal_points([line_width, label_height_percentage, show_heatmap, show_labels, show_rainbow, r, g, b])


  • line_width: the width of the box lines
  • label_height_percentage: the height of the class label as a percentage of the box
  • show_heatmap: make the box more opaque for higher-confidence detections, more transparent for less confident detections
  • show_labels: print the class label at the top of the box
  • show_rainbow: use a different color for each focal point box; pass false to provide a single color RGB value for all boxes
  • r: R component of RGB color of box, default 0
  • g: G component of RGB color of box, default 255
  • b: B component of RGB color of box, default 0


  • draw_focal_points(): draws boxes with defaults (each box a different color, with opacity according to the detection confidence).
  • draw_focal_points(5,0,false,false,false,255,0,0): draws solid red boxes with 5 pixel line width, and no class labels.


  • Choose thresholds empirically


Because I will definitely forget. Python development can be a pain.

# -- ENV --
# use python 2 - thumbor doesn't support 3 yet.
virtualenv thumbor_env --python=/path/to/python2
source thumbor_env/bin/activate

# -- DEVELOP --
pip install -e .

# -- TEST --
# i don't know why can't install pytest...but it fails without manual install.
# it could be a python2 / mac thing.
pip install pytest
python test

python sdist
# make a wheel from the source tarball (to use manifest correctly)
pip wheel --no-index --no-deps --wheel-dir dist dist/*.tar.gz
pip install twine
# make sure pip URLs are configured per
python -m twine upload --repository pypi dist/*

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for thumbor-extras, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size thumbor_extras-1.0.2-py2-none-any.whl (64.3 MB) File type Wheel Python version py2 Upload date Hashes View
Filename, size thumbor_extras-1.0.2.tar.gz (64.3 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page