Skip to content

Dave-Lopper/face_cropper_package

Repository files navigation

PyPI version Build Status Coverage Status

Face cropper

Welcome to the face cropper module !
This module will :

  • Automatically detect faces on a provided picture
  • Return the biggest one
  • Save it in a location of your choosing !

Requirements

  • Python > 3.7
  • pip > 20.1.1

Quickstart

Use as a package ?
  • pip install face-cropper
Use as a CLI ?
  • Clone the repo
  • pip install -r requirements.txt
  • python main.py --image_path=path\to\my\image --saving_path=where\to\save\cropped\image

CLI documentation

Just run the main.py module

Required arguments :
  • image_path : The path of the image to be cropped
  • saving_path : The path where the cropped image should be saved
Optionnal arguments :
  • verbose : Wether or not the command should output informations about the face detections

Module documentation

Simply import the crop function, and pass it the path of the image to be cropped as image_path !
It is also possible to pass it another parameter, saving_path, which if provided will make face_croper save the image in the provided location !

Example

Minimal start
import os

from face_cropper import crop

cropped_image = crop(
    image_path=os.path.join(os.getcwd(), "my_image.jpg")
)
import os

from face_cropper import crop

cropped_image = crop(
    image_path=os.path.join(os.getcwd(), "my_image.jpg"),
    saving_path=os.getcwd()
)
Being careful
import os

from face_cropper import crop
from face_cropper.exceptions import NoFaceException, AboveThresholdException

try:
    cropped_image = crop(
        image_path=os.path.join(os.getcwd(), "my_image.jpg")
    )
except (NoFaceException, AboveThresholdException):
    # Custom code right here

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages