Skip to main content

Snappy 2

PyPI version

Introduction

Snappy2 makes it easy to draw fun overlays on images. It uses a neural network to detect face keypoints and then uses those key points to draw overlays such as glasses, mustaches, hats, ears, and custom overlays on the face. The library is easy to use and comes with several code examples to get started quickly with a variety of drawing options:

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

Click here for live snappy2 demo.

Classes

  1. Snappy2: the main class object and one place for all snappy library control.
  2. Detector: provides advanced functionality for getting face keypoints.
  3. FacePainter: helper functions for drawing on top of images based on the received keypoints.

Imports

from snappy2 import Snappy2

Code Examples (How to)

  • Draw Mustache on face (3 lines)
snappy = Snappy2()

human_image = snappy.load_image('<file_path>')
snappy.set_mustache(human_image, mus_index=0)
  • Draw glasses on face (3 lines)
snappy = Snappy2()

human_image = snappy.load_image('<file_path>')
snappy.set_glasses(human_image, gls_index=0)
  • Draw ears on face (3 lines)
snappy = Snappy2()

human_image = snappy.load_image('<file_path>')
snappy.set_ears(human_image, gls_index=0)
  • Draw text
snappy = Snappy2()

human_image = snappy.load_image('<file_path>')
# parameters: path, text, text size, drawing location.
snappy.set_text(human_image, 'Snappy2', 60, v_position='bottom')
  • Display image for validation
human_image.show()

Github setup

Github code available here.
For more examples check the (Demo.py).

Disclaimer

This library utilizes photos that are freely accessible on the web. If any of the example photos have licensing restrictions, please reach out to the library owner directly for clarification or removal.

License

The MIT License (MIT)

Copyright (c) 2017 Ahmad Barqawi (github.com/Barqawiz)

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.

Metadata

Release files for snappy2 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snappy2 0.4
File Size Uploaded Provenance
snappy2-0.4.tar.gz 22.4 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for snappy2 0.4
File Interpreter ABI Platform
snappy2-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 67.1 MB

Release files / snappy2-0.4.tar.gz

Download URL snappy2-0.4.tar.gz
Size 22.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ae5f047c976ac18fff5a345a6afb2bb6d002aa9e333c67ef74ae68a5bd6f0b7a
BLAKE2b-256 checksum
How to use checksums
dcc14ca89e60e338f6b64e2df39252759431d100b596cdd96356053ffd463d83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.13

Release files / snappy2-0.4-py3-none-any.whl

Download URL snappy2-0.4-py3-none-any.whl
Size 44.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1ae32581be064c86c9fa2cb04a39431615dc6b88f1081d2b731edf124d5b7221
BLAKE2b-256 checksum
How to use checksums
ce30a2e42af068ee4b7b0b2bfb137a3c3aa2dc5484a285391b84edda54f7d2e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.13

Security for snappy2 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page