diff --git a/README.md b/README.md index 3cae421..275c283 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,61 @@ -# autocrop [![Travis Build Status](https://img.shields.io/travis/leblancfg/autocrop.svg)](https://travis-ci.org/leblancfg/autocrop) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/leblancfg/autocrop.svg?label=%22Windows%22)](https://ci.appveyor.com/project/leblancfg/autocrop/branch/master) [![PyPI version](https://badge.fury.io/py/autocrop.svg)](https://badge.fury.io/py/autocrop) +# autocrop +[![Travis Build Status](https://img.shields.io/travis/leblancfg/autocrop.svg)](https://travis-ci.org/leblancfg/autocrop) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/leblancfg/autocrop.svg?label=%22Windows%22)](https://ci.appveyor.com/project/leblancfg/autocrop/branch/master) [![PyPI version](https://badge.fury.io/py/autocrop.svg)](https://badge.fury.io/py/autocrop)
-Basic script using openCV, that automatically detects and crops faces from batches of photos. +Perfect for batch work for ID cards or profile picture processing for your website, autocrop will output images centered around the biggest face detected. -Perfect for batch work for ID cards or profile pictures, will output images centered around the biggest face detected. It can also add a touch of auto gamma correction. +## Use -## Installation ->**N.B. 28/019/2017**: `pip install autocrop` should now work on most platforms, as well as a basic command-line interface (CLI). Testing on further platforms is currently under way. If this fails: + usage: autocrop [-h] [-p PATH] [-w WIDTH] [-H HEIGHT] [-v] -The script will process all `.jpg` files in the `/photos` directory. The cropped files are placed in `photos/crop`, and originals are moved to `photos/bkp`. + 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 -If it can't find a face in the picture, it'll simply leave it in `/photos`. +## Installation +Simple! In your command line, type: -### conda -The easiest way to run *autocrop* is to use the [Anaconda Python distribution](https://www.anaconda.com/download/) and run the following: +~~~python +pip install autocrop +~~~ - git clone https://github.com/leblancfg/autocrop - conda install --channel conda-forge --file requirements.txt - -Move your pictures to be cropped in the *photos* directory, then run the script with: +### Gotchas +Autocrop uses OpenCV to perform face detection, which is installed through binary [wheels](http://pythonwheels.com/). If you *already* have OpenCV 3+ installed, you may wish to uninstall the additional OpenCV installation: `pip uninstall opencv-python`. - cd autocrop - python autocrop.py - -If running on Windows, this is by far the sanest way to approach this problem. Also, installing Anaconda doesn't require admin privileges on Windows. - -### pip -Otherwise, binaries for the Python-only bindings for OpenCV have recently been made available through pip, which makes installation a breeze. +### conda +Development of a `conda-forge` package for the [Anaconda Python distribution](https://www.anaconda.com/download/) is also currently slated for development. Please leave feedback on [issue #7](https://github.com/leblancfg/autocrop/issues/7) if you are insterested in helping out. - git clone https://github.com/leblancfg/autocrop - pip install numpy opencv-python - -Move your pictures to be cropped in the *photos* directory, then run the script with: +### Installing directly +In some cases, you may wish the package directly, instead of through [PyPI](https://pypi.python.org/pypi): - cd autocrop - python autocrop.py +~~~ +cd ~ +git clone https://github.com/leblancfg/autocrop +cd autocrop +pip install . +~~~ ## Requirements -The script works on Python 2.7 and 3.4+, and on Windows, macOS and Linux. It has not been tested otherwise. +Best practice for your projects is of course to [use virtual environments](http://docs.python-guide.org/en/latest/dev/virtualenvs/). At the very least, you will need to [have pip installed](https://pip.pypa.io/en/stable/installing/). +Autocrop is currently being tested on: +* Python: + - 2.7 + - 3.4 + - 3.5 + - 3.6 +* OS: + - Linux + - macOS + - Windows + ## More Info Check out: * http://docs.opencv.org/master/d7/d8b/tutorial_py_face_detection.html#gsc.tab=0