Giter Site home page Giter Site logo

autocrop's Introduction

autocrop

Travis Build Status AppVeyor Build Status PyPI version Binder

Perfect for profile picture processing for your website or batch work for ID cards, autocrop will output images centered around the biggest face detected.

Use

From the command line:

usage: autocrop [-h] [-p PATH] [-w WIDTH] [-H HEIGHT] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  folder where images to crop are located. Default:
                        photos/
  -w WIDTH, --width WIDTH
                        width of cropped files in px. Default: 500
  -H HEIGHT, --height HEIGHT
                        height of cropped files in px. Default: 500
  -v, --version         show program's version number and exit
  • Example: autocrop -p pics -w 400 -H 400.

What it does

The previous command will:

  1. Create a copy of all images found in the top level of pics to pics/bkp,
  2. Crop to 400x400 pixels all images found in the top level of pics to pics/crop.

Images where a face can't be detected will be left in pics.

Installation

Simple! In your command line, type:

pip install autocrop

Gotchas

Autocrop uses OpenCV to perform face detection, which is installed through binary wheels. If you already have OpenCV 3+ installed, you may wish to uninstall the additional OpenCV installation: pip uninstall opencv-python.

Installing directly

In some cases, you may wish the package directly, instead of through PyPI:

cd ~
git clone https://github.com/leblancfg/autocrop
cd autocrop
pip install .

conda

Development of a conda-forge package for the Anaconda Python distribution is also currently slated for development. Please leave feedback on issue #7 if you are insterested in helping out.

Requirements

Best practice for your projects is of course to use virtual environments. At the very least, you will need to have pip installed.

Autocrop is currently being tested on:

  • Python:
    • 2.7
    • 3.4
    • 3.5
    • 3.6
  • OS:
    • Linux
    • macOS
    • Windows

More Info

Check out:

Adapted from:

Contributing

Pull requests are always welcome. I don't have much time to put into this project as "I've already scratched my own itch", but realize it can be useful to larger community. If you'd like to contribute to the codebase:

  1. Fork the repository on GitHub and clone it on your local machine,
    • git clone https://github.com/your_username/autocrop
  2. Make a branch off of master and make the changes you have in mind,
    • git checkout -b issue-007
  3. Run the tests with pytest in the root-level directory to make sure you didn't mistakenly break anything else.
  4. Commit your changes: one item per commit if possible,
    • git commit -a -m 'fixed issue 007'
  5. Once development is done, always run flake8 . to check your coding style, as PEP8 is enforced and will fail your CI otherwise.
  6. Push the modified codebase back to your forked version on Github,
    • git push origin issue-007
  7. On GitHub, submit a Pull Request to the master branch.

If you'd like to have a development environment for autocrop, you should create a virtualenv and then do pip install -e . from within the directory.

autocrop's People

Contributors

leblancfg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.