Skip to main content

A Python CLI-Tool and package to pixelate or blur faces in images and videos.

Project description

Welcome to PixelateMe 👋

Your Python package for anonymising faces in images and videos

License: MIT

This CLI tool lets you pixelate, blur or remove faces from videos and images. GPU acceleration supported


Original image from unsplash.com by Susan G. Komen 3-Day

Original video from pexels.com by fauxels

⚡️ Quickstart

📥 Install

pip install pixelateme

With GPU support (additionally installs onnxruntime-gpu:

pip install pixelateme[gpu]

▶️ Run

After installation, pip registers a shortcut binary which can be called like this:

pixelateme --mode blur FOLDER_OR_FILES

This will create a new pixelated folder to hold all the pixelated files.

To launch the gui directly open the pixelategui executable from the packages folder of your python installation or:

pixelatemegui

📝 Custom code

To use this package in your own code, you can import the main module. This module exports a run method that accepts all CLI arguments as parameters.

from pixelateme.main import run

run(path=["FILE_PATHS"])

🎯 Features

  • Different anonymisation modes: pixelate, blur and color
  • GPU acceleration
  • Preview of currently processed files
  • Face Recognition to blur only certain faces or all faces except certain ones
  • ONNXRT and OpenCV run-time backend
  • Process multiple files in parallel
  • GUI

💻 CLI Arguments

  • --suffix: Filename suffix of processed files. Default:
  • --output (-o): Output directory for processed files. Default: ./pixelated
  • --mode (-m): Mode of anonymization. Default: pixelate
  • --threshold (-t): Threshold for detected faces (higher means more confidence). Default: 0.5
  • --backend: Desired backend (e.g. opencv or onnxrt). Auto prefers onnxrt and falls back to opencv. Default: auto
  • --only-blur-this-faces: Folder containing images of faces (one face per image) that should be considered for anonymisation. All other faces will not be anonymised. Default: None
  • --blur-except-this-faces: Folder containing images of faces (one face per image), which should be ignored for anonymization. Default: None
  • --ellipse: Uses ellipses as form for anonymization. Default is rectangle
  • --blur-strength: Defines how "blurry" a face will be. Only working with --mode "blur". Default: 3
  • --pixelate-size: Amount of pixelation effect. The higher the value, the harder it is to recognise the face. Default: 3
  • --deepface-similarity: The maximum similarity between two faces. A higher value means that more faces are considered equal. Only working in combination with --blur-except-this-faces or --only-blur-this-faces. Default: 0.4
  • --preview: Enable preview of the currently processed image. No preview is default
  • --face-recognition-size: Image size to use for face detection. Format: WxH (e.g. 720x480). Default: None
  • --maximum-face-recognition-size: Maximum number of pixels of the longest side for face detection. Images larger than this will be downscaled for face recognition. This doesn't affect output resolution. Default: 640
  • --multiprocessing: Enable multiprocessing to process files in videos. Useful when anonymizing multiple large videos. Disabled by default
  • --parallel-processes: Number of parallel processes. Only works with --multiprocessing enabled. Default: 4
  • --soft-mask: Enables a soft transition between blurred and original image. Disabled by default
  • --soft-mask-strength: Defines the feather strength of the mask edge. Default: 7

🔧 Settings Overview

Modes

Mode Strength 3 (default) Strength 6
Pixelate Pixelate 3 Pixelate 6
Blur Blur 3 Blur 6
Color Color

Soft Mask

Soft Mask Strength
Disabled Disabled
Strength 7 (Default) Strength 7
Strength 14 Strength 14

👏 Acknowledgements

  • deface: Deface was one of my inspirations for this package and the implementation of CenterFace.
  • CenterFace: Used for face detection
  • DeepFace: Used for face recognition
  • ONNX: Face detection backend
  • OpenCV: Face detection backend, used for I/O and face anonymisation (blur, pixelation and color)

👥 Author

👤 Marius Butz

⭐️ Show your support

  • Give a ⭐️ star if this project helped you!
  • Create a 🍴 fork and contribute by fixing bugs or adding features

Project details


Download files

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

Source Distribution

PixelateMe-1.1.0.tar.gz (7.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PixelateMe-1.1.0-py3-none-any.whl (7.0 MB view details)

Uploaded Python 3

File details

Details for the file PixelateMe-1.1.0.tar.gz.

File metadata

  • Download URL: PixelateMe-1.1.0.tar.gz
  • Upload date:
  • Size: 7.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for PixelateMe-1.1.0.tar.gz
Algorithm Hash digest
SHA256 959a2349f0b8f5f1b38fd5188a1e574cc3643514b4532bf57cbdc41436ba8780
MD5 c5f4ac406d61d66d3c900fdc5c9c6dc2
BLAKE2b-256 f286bf0ec196fb5e64ced9c41f72d7e65f71ba7cc65885b4fa4d8ac58e1f1255

See more details on using hashes here.

File details

Details for the file PixelateMe-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: PixelateMe-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for PixelateMe-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3035c9650abe221c2b4969254e992cfc4c04a9c291c3a8b0cf45aa6083db1265
MD5 1261d034624e6e88fa04bd2c12f24b6e
BLAKE2b-256 e88a824726d43e4b1e819afc5c0d21f519092fa0c621039411eeaf8f9ec6ba49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page